Documentation
¶
Index ¶
- func BuildInternalConfig(cfg IOConfig) internalSess.Config
- func DecodeData(dec *zstd.Decoder, scratch, in []byte) (payload, newScratch []byte, err error)
- func EmitProgressSamples(ctx context.Context, role Role, ns *stats.Stats)
- func EmitSDP(out io.Writer, role Role, encoded string)
- func MaybeShowQR(encoded string, disableQR bool)
- func NewDataDecoder() (*zstd.Decoder, error)
- func NewDataEncoder(level int) (*zstd.Encoder, error)
- func ReadRemoteSDP(in io.Reader) (string, error)
- func ResolveIO(cfg IOConfig) (in io.Reader, out io.Writer)
- func RunFrames(ctx context.Context, ch *session.Channel, fh protocol.FrameHandler, ...)
- func StartProgressEmitter(ctx context.Context, role Role, ns *stats.Stats) (stop func())
- type IOConfig
- type Role
- type SessionBase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildInternalConfig ¶
func BuildInternalConfig(cfg IOConfig) internalSess.Config
BuildInternalConfig maps IOConfig to an internalSess.Config.
func DecodeData ¶
DecodeData decompresses in with dec, reusing scratch to avoid allocation. When dec is nil it returns in unchanged.
func EmitProgressSamples ¶
EmitProgressSamples emits an immediate Sample tagged with role and then one every progressInterval until ctx is canceled. The initial sample guarantees at least one event for transfers that finish in tens of milliseconds (loopback benches, tiny files).
func MaybeShowQR ¶
MaybeShowQR renders a QR of encoded to stderr when not disabled, text mode is active, and the payload fits qrPayloadLimit. Oversize payloads fall back to a short notice.
func NewDataDecoder ¶
NewDataDecoder builds a single-threaded zstd decoder for DATA payloads.
func NewDataEncoder ¶
NewDataEncoder builds a single-threaded zstd encoder for DATA payloads. One per PC so the library pool doesn't multiply by N.
func ReadRemoteSDP ¶
ReadRemoteSDP prompts, reads from in, optionally unwraps a {"sdp":"..."} envelope, and returns the encoded SDP. Re-prompts on failure.
Types ¶
type IOConfig ¶
type IOConfig struct {
// SDPProvider reads the remote SDP. Nil falls back to os.Stdin.
SDPProvider io.Reader
// SDPOutput writes the local SDP. Nil falls back to os.Stdout.
SDPOutput io.Writer
// STUNServers is a list of STUN host:port entries. Each is prefixed
// with "stun:" before being passed through to the ICE config. A nil
// or empty slice disables STUN entirely — useful on a LAN where
// host/mDNS candidates are enough.
STUNServers []string
// DisableQR suppresses the QR render of the local SDP.
DisableQR bool
// LoopbackOnly pins ICE to lo0 and drops STUN (bench only).
LoopbackOnly bool
// DisableMDNS suppresses mDNS candidate gathering. Zero-value means
// mDNS is on (peers advertise `.local` hostnames for host candidates).
DisableMDNS bool
// ICELite enables pion's ICE-Lite mode on every PC this session opens.
//
// Test-only: it's only safe when both peers are ICE-lite on a guaranteed-
// routable path (loopback in-process).
//
// Production callers must leave this false; the CLI never sets it.
ICELite bool
}
IOConfig is the shared subset of sender/receiver Config driving SDP I/O and PeerConnection setup.
type SessionBase ¶
type SessionBase struct {
// contains filtered or unexported fields
}
SessionBase is embedded by sender and receiver sessions to share the NetworkStats getter and the resolved SDP I/O handles.
func NewSessionBase ¶
func NewSessionBase(ns *stats.Stats, cfg IOConfig) SessionBase
NewSessionBase returns a SessionBase holding ns and the SDP I/O handles resolved from cfg (stdin/stdout defaults applied).
func (*SessionBase) NetworkStats ¶
func (b *SessionBase) NetworkStats() *stats.Stats
NetworkStats returns the stats pointer. Meaningful after Start returns.
func (*SessionBase) SDPInput ¶
func (b *SessionBase) SDPInput() io.Reader
SDPInput returns the SDP input handle.
func (*SessionBase) SDPOutput ¶
func (b *SessionBase) SDPOutput() io.Writer
SDPOutput returns the SDP output handle.