Documentation ¶
Index ¶
- type Debug
- func (d *Debug) GetBlooms() (infos []DebugBloomInfo)
- func (d *Debug) GetPaths() (infos []DebugPathInfo)
- func (d *Debug) GetPeers() (infos []DebugPeerInfo)
- func (d *Debug) GetSelf() (info DebugSelfInfo)
- func (d *Debug) GetTree() (infos []DebugTreeInfo)
- func (d *Debug) SetDebugLookupLogger(logger func(DebugLookupInfo))
- type DebugBloomInfo
- type DebugLookupInfo
- type DebugPathInfo
- type DebugPeerInfo
- type DebugSelfInfo
- type DebugTreeInfo
- type Option
- func WithBloomTransform(xform func(key ed25519.PublicKey) ed25519.PublicKey) Option
- func WithPathNotify(notify func(key ed25519.PublicKey)) Option
- func WithPathThrottle(duration time.Duration) Option
- func WithPathTimeout(duration time.Duration) Option
- func WithPeerKeepAliveDelay(duration time.Duration) Option
- func WithPeerMaxMessageSize(size uint64) Option
- func WithPeerTimeout(duration time.Duration) Option
- func WithRouterRefresh(duration time.Duration) Option
- func WithRouterTimeout(duration time.Duration) Option
- type PacketConn
- func (pc *PacketConn) Close() error
- func (pc *PacketConn) HandleConn(key ed25519.PublicKey, conn net.Conn, prio uint8) error
- func (pc *PacketConn) IsClosed() bool
- func (pc *PacketConn) LocalAddr() net.Addr
- func (pc *PacketConn) MTU() uint64
- func (pc *PacketConn) PrivateKey() ed25519.PrivateKey
- func (pc *PacketConn) ReadFrom(p []byte) (n int, from net.Addr, err error)
- func (pc *PacketConn) SendLookup(key ed25519.PublicKey)
- func (pc *PacketConn) SetDeadline(t time.Time) error
- func (pc *PacketConn) SetReadDeadline(t time.Time) error
- func (pc *PacketConn) SetWriteDeadline(t time.Time) error
- func (pc *PacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debug ¶
type Debug struct {
// contains filtered or unexported fields
}
func (*Debug) GetBlooms ¶
func (d *Debug) GetBlooms() (infos []DebugBloomInfo)
func (*Debug) GetPaths ¶
func (d *Debug) GetPaths() (infos []DebugPathInfo)
func (*Debug) GetPeers ¶
func (d *Debug) GetPeers() (infos []DebugPeerInfo)
func (*Debug) GetSelf ¶
func (d *Debug) GetSelf() (info DebugSelfInfo)
func (*Debug) GetTree ¶
func (d *Debug) GetTree() (infos []DebugTreeInfo)
func (*Debug) SetDebugLookupLogger ¶
func (d *Debug) SetDebugLookupLogger(logger func(DebugLookupInfo))
type DebugBloomInfo ¶
type DebugLookupInfo ¶
type DebugPathInfo ¶
type DebugPeerInfo ¶
type DebugSelfInfo ¶
type DebugTreeInfo ¶
type Option ¶
type Option func(*config)
func WithBloomTransform ¶
func WithPathNotify ¶
func WithPathThrottle ¶
func WithPathTimeout ¶
func WithPeerKeepAliveDelay ¶
func WithPeerMaxMessageSize ¶
func WithPeerTimeout ¶
func WithRouterRefresh ¶
func WithRouterTimeout ¶
type PacketConn ¶
type PacketConn struct { Debug Debug // contains filtered or unexported fields }
func NewPacketConn ¶
func NewPacketConn(secret ed25519.PrivateKey, options ...Option) (*PacketConn, error)
NewPacketConn returns a *PacketConn struct which implements the types.PacketConn interface.
func (*PacketConn) HandleConn ¶
HandleConn expects a peer's public key as its first argument, and a net.Conn with TCP-like semantics (reliable ordered delivery) as its second argument. This function blocks while the net.Conn is in use, and returns an error if any occurs. This function returns (almost) immediately if PacketConn.Close() is called. In all cases, the net.Conn is closed before returning.
func (*PacketConn) IsClosed ¶
func (pc *PacketConn) IsClosed() bool
IsClosed returns true if and only if the connection is closed. This is to check if the PacketConn is closed without potentially being stuck on a blocking operation (e.g. a read or write).
func (*PacketConn) LocalAddr ¶
func (pc *PacketConn) LocalAddr() net.Addr
LocalAddr returns a types.Addr of the ed25519.PublicKey for this PacketConn.
func (*PacketConn) MTU ¶
func (pc *PacketConn) MTU() uint64
MTU returns the maximum transmission unit of the PacketConn, i.e. maximum safe message size to send over the network.
func (*PacketConn) PrivateKey ¶
func (pc *PacketConn) PrivateKey() ed25519.PrivateKey
PrivateKey() returns the ed25519.PrivateKey used to initialize the PacketConn.
func (*PacketConn) ReadFrom ¶
ReadFrom fulfills the net.PacketConn interface, with a types.Addr returned as the from address. Note that failing to call ReadFrom may cause the connection to block and/or leak memory.
func (*PacketConn) SendLookup ¶
func (pc *PacketConn) SendLookup(key ed25519.PublicKey)
func (*PacketConn) SetDeadline ¶
func (pc *PacketConn) SetDeadline(t time.Time) error
SetDeadline fulfills the net.PacketConn interface. Note that only read deadlines are affected.
func (*PacketConn) SetReadDeadline ¶
func (pc *PacketConn) SetReadDeadline(t time.Time) error
SetReadDeadline fulfills the net.PacketConn interface.
func (*PacketConn) SetWriteDeadline ¶
func (pc *PacketConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline fulfills the net.PacketConn interface.