sender

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPeerSetupTimeoutForTest

func SetPeerSetupTimeoutForTest(timeout time.Duration)

SetPeerSetupTimeoutForTest overrides the peer-setup timeout for tests. Pass 0 to reset.

Types

type Config

type Config struct {
	// IOConfig carries SDP I/O, STUN, QR, and loopback settings.
	transfer.IOConfig
	// Stream is the file/reader to transmit. Must be seekable (pre-hash rewinds).
	Stream io.ReadSeeker
	// CompressionLevel is the zstd level (0 disables; 1..22 map to klauspost buckets).
	CompressionLevel int
	// Connections is the number of parallel data PeerConnections (1..16).
	Connections int
}

Config holds sender-side configuration.

func (Config) Validate

func (c Config) Validate() error

Validate checks Config fields. NewWith does not re-validate.

type Session

type Session struct {
	transfer.SessionBase
	// contains filtered or unexported fields
}

Session is a sender session.

func New

func New(file io.ReadSeeker) *Session

New returns a single-PC sender with stdin/stdout SDP and default settings.

func NewWith

func NewWith(cfg Config) (*Session, error)

NewWith returns a sender configured from cfg. Call Config.Validate() first.

func (*Session) Initialize

func (s *Session) Initialize() error

Initialize creates the PeerConnection and the data channel, then emits the local offer SDP.

func (*Session) Start

func (s *Session) Start() error

Start opens the connection and drives the file transfer.

Jump to

Keyboard shortcuts

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