Documentation
¶
Index ¶
- Variables
- func SetModifyDiscoConfig(modify func(cfg *DiscoConfig))
- type DiscoConfig
- type PeerState
- type PeerStore
- type RelayToPeerError
- type UDPConfig
- type UDPConn
- func (c *UDPConn) Close() error
- func (c *UDPConn) Datagrams() <-chan *disco.Datagram
- func (c *UDPConn) DetectNAT(ctx context.Context, stunServers []string) (info disco.NATInfo)
- func (c *UDPConn) Endpoints() <-chan *disco.Endpoint
- func (c *UDPConn) Errors() <-chan error
- func (c *UDPConn) GenerateLocalAddrsSends(peerID disco.PeerID, stunServers []string)
- func (c *UDPConn) NATEvents() <-chan *disco.NATInfo
- func (c *UDPConn) Peers() []PeerState
- func (c *UDPConn) RelayTo(relay disco.PeerID, p []byte, peerID disco.PeerID) (int, error)
- func (c *UDPConn) RestartListener() error
- func (c *UDPConn) RunDiscoMessageSendLoop(udpAddr disco.Endpoint)
- func (c *UDPConn) SetReadBuffer(bytes int) error
- func (c *UDPConn) SetWriteBuffer(bytes int) error
- func (c *UDPConn) WriteTo(p []byte, peerID disco.PeerID) (int, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MAGIC_TO_RELAY = []byte{'_', 'p', 'g', 1} MAGIC_FROM_RELAY = []byte{'_', 'p', 'g', 3} )
View Source
var ( ErrUDPConnNotReady = errors.New("udpConn not ready yet") ErrUDPConnInactive = errors.New("udpConn inactive") )
Functions ¶
func SetModifyDiscoConfig ¶
func SetModifyDiscoConfig(modify func(cfg *DiscoConfig))
Types ¶
type DiscoConfig ¶
type DiscoConfig struct { PortScanOffset int `yaml:"port_scan_offset"` PortScanCount int `yaml:"port_scan_count"` PortScanDuration time.Duration `yaml:"port_scan_duration"` ChallengesRetry int `yaml:"challenges_retry"` ChallengesInitialInterval time.Duration `yaml:"challenges_initial_interval"` ChallengesBackoffRate float64 `yaml:"challenges_backoff_rate"` IgnoredInterfaces []string `yaml:"ignored_interfaces"` }
type PeerStore ¶
type PeerStore interface { // Peers load all peers (peers order is stable) Peers() []PeerState }
type RelayToPeerError ¶ added in v0.11.3
func (RelayToPeerError) Error ¶ added in v0.11.3
func (e RelayToPeerError) Error() string
func (RelayToPeerError) Unwrap ¶ added in v0.11.3
func (e RelayToPeerError) Unwrap() error
type UDPConn ¶
type UDPConn struct {
// contains filtered or unexported fields
}
func (*UDPConn) GenerateLocalAddrsSends ¶
func (*UDPConn) RestartListener ¶
func (*UDPConn) RunDiscoMessageSendLoop ¶
func (*UDPConn) SetReadBuffer ¶
SetReadBuffer sets the size of the operating system's receive buffer associated with the connection.
func (*UDPConn) SetWriteBuffer ¶
SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection.
Click to show internal directories.
Click to hide internal directories.