filetransfer

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const FileDestHost = "file.vx"

Variables

This section is empty.

Functions

func Send

func Send(ctx context.Context, handler i.Handler, filePath string, progress ProgressFunc) error

Send copies filePath over handler as a file-transfer stream.

func WriteFile

func WriteFile(ctx context.Context, rw buf.ReaderWriter, filePath string, progress ProgressFunc) error

WriteFile writes a framed file to rw.

Types

type Header struct {
	Name string
	Size uint64
}

Header is the metadata sent ahead of the file payload.

type ProgressFunc

type ProgressFunc func(done, total uint64)

ProgressFunc is called with bytes copied so far and the known total (0 if unknown).

type ReceiveEvent

type ReceiveEvent struct {
	Filename string
	SavePath string
	Done     uint64
	Total    uint64
	Complete bool
	Err      error
}

ReceiveEvent is emitted by Receiver as files arrive.

type Receiver

type Receiver struct {
	SaveDir string
	OnEvent func(ReceiveEvent)
	// contains filtered or unexported fields
}

Receiver writes inbound file-transfer streams to SaveDir.

func (*Receiver) HandleFlow

func (r *Receiver) HandleFlow(ctx context.Context, _ net.Destination, rw buf.ReaderWriter) error

func (*Receiver) HandlePacketConn

func (r *Receiver) HandlePacketConn(ctx context.Context, dst net.Destination, p udp.PacketReaderWriter) error

Jump to

Keyboard shortcuts

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