sftpaudit

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	At   time.Time `json:"at"`
	Op   Op        `json:"op"`
	Path string    `json:"path"`
	// NewPath yalnızca rename ve symlink'te dolu.
	NewPath string `json:"new_path,omitempty"`
	// Flags yalnızca open/transfer'da dolu ("read", "write,creat,trunc").
	Flags string `json:"flags,omitempty"`

	// Read/Wrote, transfer olayında GERÇEKTEN taşınan bayt.
	Read  int64 `json:"read,omitempty"`
	Wrote int64 `json:"wrote,omitempty"`

	// OK, hedefin işlemi kabul edip etmediği.
	OK     bool   `json:"ok"`
	Status uint32 `json:"status,omitempty"`
	Detail string `json:"detail,omitempty"`
}

Event, denetim kaydına düşen tek satır.

type Op

type Op string

Op, denetim olayının cinsi.

const (
	OpOpen     Op = "open"
	OpTransfer Op = "transfer"
	OpRemove   Op = "remove"
	OpRename   Op = "rename"
	OpMkdir    Op = "mkdir"
	OpRmdir    Op = "rmdir"
	OpSetstat  Op = "setstat"
	OpSymlink  Op = "symlink"
	OpOpendir  Op = "opendir"
	OpLink     Op = "hardlink"
	OpExtended Op = "extended"
)

type Session

type Session struct {
	// contains filtered or unexported fields
}

* Session, tek bir SFTP kanalının iki yönünü izler. * * İki yön ayrı goroutine'lerden besleniyor (istemci→hedef ve hedef→ * istemci kopyaları paralel akıyor), bu yüzden durum kilit altında.

func NewSession

func NewSession(emit func(Event)) *Session

NewSession, izleyiciyi kurar. emit her olay için çağrılıyor.

func (*Session) Finish

func (s *Session) Finish()

* Finish, kanal kapanırken YARIM KALAN transferleri yazar. * * ⚠️ NEDEN ŞART: bağlantı transfer ortasında koparsa CLOSE hiç gelmez. * Bu olmadan, yarıda kesilen 1 GB'lık bir indirme denetim kaydında HİÇ * görünmezdi — yani veriyi çekip bağlantıyı koparmak, izi silmenin yolu * olurdu.

func (*Session) FromClient

func (s *Session) FromClient(p []byte) error

FromClient, istemci→hedef akışından gelen baytları verir.

func (*Session) FromTarget

func (s *Session) FromTarget(p []byte) error

FromTarget, hedef→istemci akışından gelen baytları verir.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL