Documentation
¶
Index ¶
- Constants
- Variables
- func DerptunAppDial(ctx context.Context, cfg DerptunAppDialConfig) (*derptun.Mux, func(), error)
- func DerptunAppDialStream(ctx context.Context, cfg DerptunAppDialConfig) (net.Conn, func(), error)
- func DerptunAppServe(ctx context.Context, cfg DerptunAppServeConfig) error
- func DerptunConnect(ctx context.Context, cfg DerptunConnectConfig) error
- func DerptunOpen(ctx context.Context, cfg DerptunOpenConfig) error
- func DerptunServe(ctx context.Context, cfg DerptunServeConfig) error
- func DialAttach(ctx context.Context, cfg AttachDialConfig) (net.Conn, error)
- func Listen(ctx context.Context, cfg ListenConfig) (string, error)
- func Offer(ctx context.Context, cfg OfferConfig) (string, error)
- func Open(ctx context.Context, cfg OpenConfig) error
- func Receive(ctx context.Context, cfg ReceiveConfig) error
- func Send(ctx context.Context, cfg SendConfig) error
- func Share(ctx context.Context, cfg ShareConfig) (string, error)
- type AttachDialConfig
- type AttachListenConfig
- type AttachListener
- type BlockReceiveRequest
- type BlockReceiveSink
- type BlockReceiver
- type BlockSource
- type ConcurrentBlockReceiveSink
- type DerptunAppDialConfig
- type DerptunAppServeConfig
- type DerptunConnectConfig
- type DerptunOpenConfig
- type DerptunServeConfig
- type DirectBlockReceiveSink
- type ListenConfig
- type OfferConfig
- type OpenConfig
- type ParallelMode
- type ParallelPolicy
- type ReceiveConfig
- type SendConfig
- type ShareConfig
- type State
Constants ¶
const ( DefaultParallelStripes = 8 DefaultParallelInitial = DefaultParallelStripes MaxParallelStripes = 16 AutoParallelSamplePeriod = 500 * time.Millisecond AutoParallelGrowthStep = 2 AutoParallelTargetFloor = DefaultParallelStripes AutoParallelHoldSamples = 4 AutoParallelMinGainMbps = 50 AutoParallelMinGainPercent = 10 )
Variables ¶
var ErrPeerAborted = errors.New("peer aborted transfer")
var ErrPeerDisconnected = errors.New("peer disconnected")
var ErrSessionClaimed = errors.New("session already claimed")
var ErrUnknownSession = errors.New("unknown session")
Functions ¶
func DerptunAppDial ¶ added in v0.15.2
DerptunAppDial claims a derptun app session and returns a connected mux. The returned cleanup function closes the mux and releases the underlying transport resources; callers should call cleanup once they are done with the mux.
func DerptunAppDialStream ¶ added in v0.15.2
DerptunAppDialStream claims a derptun app session and opens one stream on the returned mux. The returned cleanup function closes the mux and transport; the caller still owns the returned stream and may close it independently.
func DerptunAppServe ¶ added in v0.15.2
func DerptunAppServe(ctx context.Context, cfg DerptunAppServeConfig) error
DerptunAppServe serves one derptun app mux at a time and passes each claimed mux to cfg.OnMux. The helper owns the mux and closes it when OnMux returns or the session shuts down; cfg.OnMux should keep running until it is done serving the peer.
func DerptunConnect ¶ added in v0.8.0
func DerptunConnect(ctx context.Context, cfg DerptunConnectConfig) error
func DerptunOpen ¶ added in v0.8.0
func DerptunOpen(ctx context.Context, cfg DerptunOpenConfig) error
func DerptunServe ¶ added in v0.8.0
func DerptunServe(ctx context.Context, cfg DerptunServeConfig) error
func DialAttach ¶
Types ¶
type AttachDialConfig ¶
type AttachListenConfig ¶
type AttachListener ¶
type AttachListener struct {
Token string
// contains filtered or unexported fields
}
func ListenAttach ¶
func ListenAttach(ctx context.Context, cfg AttachListenConfig) (*AttachListener, error)
func (*AttachListener) Close ¶
func (l *AttachListener) Close() error
type BlockReceiveRequest ¶ added in v0.16.0
type BlockReceiveSink ¶ added in v0.16.0
type BlockReceiver ¶ added in v0.16.0
type BlockReceiver func(context.Context, BlockReceiveRequest) (BlockReceiveSink, error)
type BlockSource ¶ added in v0.16.0
type ConcurrentBlockReceiveSink ¶ added in v0.17.0
type ConcurrentBlockReceiveSink interface {
BlockReceiveSink
ConcurrentWriteAtSafe() bool
}
ConcurrentBlockReceiveSink is an optional capability for sinks whose WriteAt implementation permits calls from multiple goroutines. Block sinks without this capability remain serialized.
type DerptunAppDialConfig ¶ added in v0.15.2
type DerptunAppServeConfig ¶ added in v0.15.2
type DerptunConnectConfig ¶ added in v0.8.0
type DerptunOpenConfig ¶ added in v0.8.0
type DerptunServeConfig ¶ added in v0.8.0
type DirectBlockReceiveSink ¶ added in v0.17.0
type DirectBlockReceiveSink interface {
BlockReceiveSink
DirectWriteBuffer() []byte
CommitDirectWrite(bytes int, highestEnd int64) error
}
DirectBlockReceiveSink is an optional capability for file-backed sinks that expose the destination's page-cache mapping. Bulk packet receivers copy only authenticated payload into the buffer and report committed bytes in batches.
type ListenConfig ¶
type OfferConfig ¶
type OfferConfig struct {
Emitter *telemetry.Emitter
TokenSink chan<- string
StdioIn io.Reader
StdioExpectedBytes int64
BlockSource *BlockSource
ForceRelay bool
UsePublicDERP bool
ParallelPolicy ParallelPolicy
Trace *transfertrace.Recorder
Progress func(bytesReceived int64, transferElapsedMS int64)
DirectTCPPort int
}
type OpenConfig ¶
type ParallelMode ¶
type ParallelMode string
const ( ParallelModeFixed ParallelMode = "fixed" ParallelModeAuto ParallelMode = "auto" )
type ParallelPolicy ¶
type ParallelPolicy struct {
Mode ParallelMode
Initial int
Cap int
}
func AutoParallelPolicy ¶
func AutoParallelPolicy() ParallelPolicy
func DefaultParallelPolicy ¶
func DefaultParallelPolicy() ParallelPolicy
func FixedParallelPolicy ¶
func FixedParallelPolicy(n int) ParallelPolicy
func ParseParallelPolicy ¶
func ParseParallelPolicy(raw string) (ParallelPolicy, error)
type ReceiveConfig ¶
type SendConfig ¶
type SendConfig struct {
Token string
Emitter *telemetry.Emitter
StdioIn io.Reader
StdioExpectedBytes int64
BlockSource *BlockSource
ForceRelay bool
UsePublicDERP bool
ParallelPolicy ParallelPolicy
Trace *transfertrace.Recorder
Progress func(bytesReceived int64, transferElapsedMS int64)
DirectTCPPort int
}
type ShareConfig ¶
type ShareConfig struct {
}
type State ¶
type State string
const ( StateWaiting State = "waiting-for-claim" StateClaimed State = "claimed" StateProbing State = "probing-direct" StateDirect State = "connected-direct" StateTryingDirect State = "trying-direct" StateDirectFallbackRelay State = "direct-fallback-relay" StateRelay State = "connected-relay" StateComplete State = "stream-complete" )
Source Files
¶
- attach.go
- attach_session.go
- counting.go
- derp_route.go
- derptun.go
- derptun_app.go
- external.go
- external_attach.go
- external_control_security.go
- external_path_metrics.go
- external_peer_progress.go
- external_quic_stream.go
- external_share.go
- external_socket_buffer.go
- external_socket_buffer_unix.go
- external_striped.go
- external_transfer_metrics.go
- external_transport_security.go
- external_v2.go
- external_v2_block.go
- external_v2_bulk_decision.go
- external_v2_bulk_packet.go
- external_v2_bulk_packet_async_writer.go
- external_v2_bulk_packet_batch.go
- external_v2_bulk_packet_batch_linux.go
- external_v2_bulk_packet_batch_other.go
- external_v2_bulk_packet_batched_receiver.go
- external_v2_bulk_packet_batched_sender.go
- external_v2_bulk_packet_candidate.go
- external_v2_bulk_packet_controller.go
- external_v2_bulk_packet_grouped.go
- external_v2_bulk_packet_grouped_receiver.go
- external_v2_bulk_packet_handoff.go
- external_v2_bulk_packet_missing.go
- external_v2_bulk_packet_peer_linux.go
- external_v2_bulk_packet_probe.go
- external_v2_bulk_packet_send_linux.go
- external_v2_bulk_probe_control.go
- external_v2_dataplane.go
- external_v2_direct_tcp.go
- external_v2_direct_tcp_info_linux.go
- external_v2_offer.go
- external_v2_protocol.go
- external_v2_raw_direct.go
- listen.go
- offer.go
- open.go
- parallel.go
- send.go
- share.go
- types.go