Documentation
¶
Overview ¶
Package udp implements a UDP based peering.NetworkProvider.
Index ¶
- type NetImpl
- func (n *NetImpl) Attach(peeringID *peering.PeeringID, callback func(recv *peering.RecvEvent)) interface{}
- func (n *NetImpl) Await(timeout time.Duration) error
- func (n *NetImpl) Close()
- func (n *NetImpl) Detach(attachID interface{})
- func (n *NetImpl) DistrustPeer(pubKey ed25519.PublicKey) (*peering.TrustedPeer, error)
- func (n *NetImpl) IsAlive() bool
- func (n *NetImpl) IsTrustedPeer(pubKey ed25519.PublicKey) error
- func (n *NetImpl) NetID() string
- func (n *NetImpl) PeerByNetID(peerNetID string) (peering.PeerSender, error)
- func (n *NetImpl) PeerByPubKey(peerPub *ed25519.PublicKey) (peering.PeerSender, error)
- func (n *NetImpl) PeerDomain(peerNetIDs []string) (peering.PeerDomainProvider, error)
- func (n *NetImpl) PeerGroup(peerNetIDs []string) (peering.GroupProvider, error)
- func (n *NetImpl) PeerStatus() []peering.PeerStatusProvider
- func (n *NetImpl) PubKey() *ed25519.PublicKey
- func (n *NetImpl) Run(shutdownSignal <-chan struct{})
- func (n *NetImpl) Self() peering.PeerSender
- func (n *NetImpl) SendMsg(msg *peering.PeerMessage)
- func (n *NetImpl) TrustPeer(pubKey ed25519.PublicKey, netID string) (*peering.TrustedPeer, error)
- func (n *NetImpl) TrustedPeers() ([]*peering.TrustedPeer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetImpl ¶
type NetImpl struct {
// contains filtered or unexported fields
}
NetImpl implements a peering.NetworkProvider interface.
func NewNetworkProvider ¶
func NewNetworkProvider( myNetID string, port int, nodeKeyPair *ed25519.KeyPair, trusted peering.TrustedNetworkManager, log *logger.Logger, ) (*NetImpl, error)
NewNetworkProvider is a constructor for the TCP based peering network implementation.
func (*NetImpl) Attach ¶
func (n *NetImpl) Attach(peeringID *peering.PeeringID, callback func(recv *peering.RecvEvent)) interface{}
Attach implements peering.NetworkProvider.
func (*NetImpl) Close ¶
func (n *NetImpl) Close()
Close implements peering.PeerSender for the Self() node.
func (*NetImpl) Detach ¶
func (n *NetImpl) Detach(attachID interface{})
Detach implements peering.NetworkProvider.
func (*NetImpl) DistrustPeer ¶ added in v0.2.0
DistrustPeer implements the peering.TrustedNetworkManager interface. It delegates everything to other implementation and updates the connections accordingly.
func (*NetImpl) IsTrustedPeer ¶ added in v0.2.0
IsTrustedPeer implements the peering.TrustedNetworkManager interface.
func (*NetImpl) PeerByNetID ¶
func (n *NetImpl) PeerByNetID(peerNetID string) (peering.PeerSender, error)
PeerByNetID implements peering.NetworkProvider.
func (*NetImpl) PeerByPubKey ¶
PeerByPubKey implements peering.NetworkProvider. NOTE: For now, only known nodes can be looked up by PubKey.
func (*NetImpl) PeerDomain ¶ added in v0.2.0
func (n *NetImpl) PeerDomain(peerNetIDs []string) (peering.PeerDomainProvider, error)
Domain creates peering.PeerDomainProvider.
func (*NetImpl) PeerGroup ¶ added in v0.2.0
func (n *NetImpl) PeerGroup(peerNetIDs []string) (peering.GroupProvider, error)
Group creates peering.GroupProvider.
func (*NetImpl) PeerStatus ¶
func (n *NetImpl) PeerStatus() []peering.PeerStatusProvider
PeerStatus implements peering.NetworkProvider.
func (*NetImpl) Run ¶
func (n *NetImpl) Run(shutdownSignal <-chan struct{})
Run starts listening and communicating with the network.
func (*NetImpl) Self ¶
func (n *NetImpl) Self() peering.PeerSender
Self implements peering.NetworkProvider.
func (*NetImpl) SendMsg ¶
func (n *NetImpl) SendMsg(msg *peering.PeerMessage)
SendMsg implements peering.PeerSender for the Self() node.
func (*NetImpl) TrustPeer ¶ added in v0.2.0
TrustPeer implements the peering.TrustedNetworkManager interface. It delegates everything to other implementation and updates the connections accordingly.
func (*NetImpl) TrustedPeers ¶ added in v0.2.0
func (n *NetImpl) TrustedPeers() ([]*peering.TrustedPeer, error)
TrustedPeers implements the peering.TrustedNetworkManager interface.