Versions in this module Expand all Collapse all v0 v0.4.5 May 17, 2024 v0.4.4 May 17, 2024 v0.4.3 May 17, 2024 v0.4.2 May 17, 2024 Changes in this version + const NameSize + const PeerNameFlavour + const Protocol + const ProtocolGossip + const ProtocolGossipBroadcast + const ProtocolGossipUnicast + const ProtocolHeartbeat + const ProtocolMaxVersion + const ProtocolMinVersion + const ProtocolOverlayControlMsg + const ProtocolReserved1 + const ProtocolReserved2 + const ProtocolReserved3 + const UnknownPeerName + var ChannelSize = 16 + var Port = 6783 + type Config struct + ConnLimit int + GossipInterval *time.Duration + Host string + Password []byte + PeerDiscovery bool + Port int + ProtocolMinVersion byte + TrustedSubnets []*net.IPNet + type Connection interface + Remote func() *Peer + type Gossip interface + GossipBroadcast func(update GossipData) + GossipNeighbourSubset func(update GossipData) + GossipUnicast func(dst PeerName, msg []byte) error + type GossipData interface + Encode func() [][]byte + Merge func(GossipData) GossipData + type Gossiper interface + Gossip func() (complete GossipData) + OnGossip func(msg []byte) (delta GossipData, err error) + OnGossipBroadcast func(src PeerName, update []byte) (received GossipData, err error) + OnGossipUnicast func(src PeerName, msg []byte) error + type LocalConnection struct + OverlayConn OverlayConnection + func (conn *LocalConnection) Remote() *Peer + func (conn *LocalConnection) SendProtocolMsg(m protocolMsg) error + type LocalConnectionStatus struct + Address string + Attrs map[string]interface{} + Info string + Outbound bool + State string + type Logger interface + Printf func(format string, args ...interface{}) + type NullOverlay struct + func (NullOverlay) AddFeaturesTo(map[string]string) + func (NullOverlay) Attrs() map[string]interface{} + func (NullOverlay) Confirm() + func (NullOverlay) ControlMessage(byte, []byte) + func (NullOverlay) Diagnostics() interface{} + func (NullOverlay) ErrorChannel() <-chan error + func (NullOverlay) EstablishedChannel() <-chan struct{} + func (NullOverlay) PrepareConnection(OverlayConnectionParams) (OverlayConnection, error) + func (NullOverlay) Stop() + type Overlay interface + AddFeaturesTo func(map[string]string) + Diagnostics func() interface{} + PrepareConnection func(OverlayConnectionParams) (OverlayConnection, error) + Stop func() + type OverlayConnection interface + Attrs func() map[string]interface{} + Confirm func() + ControlMessage func(tag byte, msg []byte) + ErrorChannel func() <-chan error + EstablishedChannel func() <-chan struct{} + Stop func() + type OverlayConnectionParams struct + ConnUID uint64 + Features map[string]string + LocalAddr *net.TCPAddr + Outbound bool + RemoteAddr *net.TCPAddr + RemotePeer *Peer + SendControlMessage func(tag byte, msg []byte) error + SessionKey *[32]byte + type Peer struct + Name PeerName + func (peer *Peer) String() string + type PeerDescription struct + Name PeerName + NickName string + NumConnections int + Self bool + UID PeerUID + type PeerName uint64 + func PeerNameFromBin(nameByte []byte) PeerName + func PeerNameFromString(nameStr string) (PeerName, error) + func PeerNameFromUserInput(userInput string) (PeerName, error) + func (name PeerName) String() string + type PeerShortID uint16 + type PeerStatus struct + Connections []connectionStatus + Name string + NickName string + ShortID PeerShortID + UID PeerUID + Version uint64 + type PeerUID uint64 + type Peers struct + func (peers *Peers) Descriptions() []PeerDescription + func (peers *Peers) Fetch(name PeerName) *Peer + func (peers *Peers) FetchByShortID(shortID PeerShortID) *Peer + func (peers *Peers) GarbageCollect() + func (peers *Peers) OnGC(callback func(*Peer)) + func (peers *Peers) OnInvalidateShortIDs(callback func()) + type Router struct + ConnectionMaker *connectionMaker + Ourself *localPeer + Overlay Overlay + Peers *Peers + Routes *routes + func NewRouter(config Config, name PeerName, nickName string, overlay Overlay, logger Logger) (*Router, error) + func (router *Router) Gossip() GossipData + func (router *Router) NewGossip(channelName string, g Gossiper) (Gossip, error) + func (router *Router) OnGossip(update []byte) (GossipData, error) + func (router *Router) OnGossipBroadcast(_ PeerName, update []byte) (GossipData, error) + func (router *Router) OnGossipUnicast(sender PeerName, msg []byte) error + func (router *Router) Start() + func (router *Router) Stop() error + type Status struct + BroadcastRoutes []broadcastRouteStatus + Connections []LocalConnectionStatus + Encryption bool + Name string + NickName string + OverlayDiagnostics interface{} + PeerDiscovery bool + Peers []PeerStatus + Port int + Protocol string + ProtocolMaxVersion int + ProtocolMinVersion int + Targets []string + TerminationCount int + TrustedSubnets []string + UnicastRoutes []unicastRouteStatus + func NewStatus(router *Router) *Status