Documentation ¶
Index ¶
- Variables
- func AddIgnoredLocalCIDRs(cidrs ...string)
- func ListLocalIPs() ([]net.IP, error)
- func SetIgnoredLocalCIDRs(cidrs ...string)
- func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string)
- func SetLocalIPs(ips ...net.IP)
- func SetModifyDiscoConfig(modify func(cfg *DiscoConfig))
- func SetNetwotkDetectInterval(interval time.Duration)
- type Datagram
- type Disco
- type DiscoConfig
- type PeerContext
- type PeerFindEvent
- type PeerState
- type PeerStore
- type PeerUDPAddrEvent
- type STUNSession
- type UDPConn
- func (c *UDPConn) Broadcast(b []byte) (peerCount int, err error)
- func (c *UDPConn) Close() error
- func (c *UDPConn) Datagrams() <-chan *Datagram
- func (c *UDPConn) FindPeer(peerID peer.ID) (*PeerContext, bool)
- func (c *UDPConn) GenerateLocalAddrsSends(peerID peer.ID, stunServers []string)
- func (c *UDPConn) NetworkChangedEvents() <-chan struct{}
- func (c *UDPConn) RunDiscoMessageSendLoop(peerID peer.ID, addr *net.UDPAddr)
- func (c *UDPConn) SetKeepAlivePeriod(period time.Duration)
- func (c *UDPConn) UDPAddrSends() <-chan *PeerUDPAddrEvent
- func (n *UDPConn) WriteToUDP(p []byte, peerID peer.ID) (int, error)
- type WSConn
- func (c *WSConn) Close() error
- func (c *WSConn) CloseConn() error
- func (c *WSConn) Datagrams() <-chan *Datagram
- func (c *WSConn) LeadDisco(peerID peer.ID) error
- func (c *WSConn) Peers() <-chan *PeerFindEvent
- func (c *WSConn) PeersUDPAddrs() <-chan *PeerUDPAddrEvent
- func (c *WSConn) STUNs() []string
- func (c *WSConn) WriteTo(p []byte, peerID peer.ID, op byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUseOfClosedConnection error = errors.New("use of closed network connection")
)
Functions ¶
func AddIgnoredLocalCIDRs ¶ added in v0.0.2
func AddIgnoredLocalCIDRs(cidrs ...string)
func ListLocalIPs ¶
func SetIgnoredLocalCIDRs ¶
func SetIgnoredLocalCIDRs(cidrs ...string)
func SetIgnoredLocalInterfaceNamePrefixs ¶
func SetIgnoredLocalInterfaceNamePrefixs(prefixs ...string)
func SetLocalIPs ¶ added in v0.0.2
func SetModifyDiscoConfig ¶ added in v0.0.2
func SetModifyDiscoConfig(modify func(cfg *DiscoConfig))
func SetNetwotkDetectInterval ¶ added in v0.2.3
Types ¶
type DiscoConfig ¶ added in v0.0.2
type PeerContext ¶
type PeerContext struct { PeerID peer.ID States map[string]*PeerState CreateTime time.Time // contains filtered or unexported fields }
func (*PeerContext) Close ¶ added in v0.0.2
func (peer *PeerContext) Close() error
func (*PeerContext) Healthcheck ¶ added in v0.0.2
func (peer *PeerContext) Healthcheck()
func (*PeerContext) Heartbeat ¶ added in v0.0.2
func (peer *PeerContext) Heartbeat(addr *net.UDPAddr)
func (*PeerContext) IPv4Ready ¶
func (peer *PeerContext) IPv4Ready() bool
func (*PeerContext) Keepalive ¶ added in v0.0.2
func (peer *PeerContext) Keepalive()
func (*PeerContext) Ready ¶
func (peer *PeerContext) Ready() bool
func (*PeerContext) Select ¶
func (peer *PeerContext) Select() *net.UDPAddr
type PeerStore ¶ added in v0.0.2
type PeerStore interface {
FindPeer(peer.ID) (*PeerContext, bool)
}
type UDPConn ¶
func (*UDPConn) FindPeer ¶ added in v0.0.2
func (c *UDPConn) FindPeer(peerID peer.ID) (*PeerContext, bool)
func (*UDPConn) GenerateLocalAddrsSends ¶
func (*UDPConn) NetworkChangedEvents ¶ added in v0.2.1
func (c *UDPConn) NetworkChangedEvents() <-chan struct{}
func (*UDPConn) RunDiscoMessageSendLoop ¶
func (*UDPConn) SetKeepAlivePeriod ¶ added in v0.0.2
SetKeepAlivePeriod set udp keepalive period
func (*UDPConn) UDPAddrSends ¶
func (c *UDPConn) UDPAddrSends() <-chan *PeerUDPAddrEvent
type WSConn ¶
func DialPeermap ¶ added in v0.2.3
func (*WSConn) Peers ¶
func (c *WSConn) Peers() <-chan *PeerFindEvent
func (*WSConn) PeersUDPAddrs ¶
func (c *WSConn) PeersUDPAddrs() <-chan *PeerUDPAddrEvent
Click to show internal directories.
Click to hide internal directories.