Documentation ¶
Index ¶
- Constants
- func BuildUserAgent(name string) string
- func ConvertToInterfacePubkey(pubkey *ecdsa.PublicKey) crypto.PubKey
- func ConvertToSingleMultiAddr(node *qnode.Node) (ma.Multiaddr, error)
- func IpAddr() net.IP
- func MakePeer(addr string) (*peer.AddrInfo, error)
- func MultiAddrFromString(address string) (ma.Multiaddr, error)
- func PrivateKey(dataDir string, privateKeyPath string, readWritePermissions os.FileMode) (crypto.PrivKey, error)
- func ProtocolDHT() protocol.ID
- func SerializeQNR(record *qnr.Record) (string, error)
- func ToECDSAPrivKey(privKey crypto.PrivKey) (*ecdsa.PrivateKey, error)
- func UseLogger(logger l.Logger)
- type Listener
- type PrivateP2PAPI
- func (api *PrivateP2PAPI) AddPeer(qmaddr string) (interface{}, error)
- func (api *PrivateP2PAPI) Banlist() (interface{}, error)
- func (api *PrivateP2PAPI) CheckConsistency(hashOrNumber string) (interface{}, error)
- func (api *PrivateP2PAPI) DelPeer(pid string) (interface{}, error)
- func (api *PrivateP2PAPI) DisableRelayTx(dis bool) (interface{}, error)
- func (api *PrivateP2PAPI) Pause() (interface{}, error)
- func (api *PrivateP2PAPI) Ping(addr string, port uint, protocol string) (interface{}, error)
- func (api *PrivateP2PAPI) ReloadPeers() error
- func (api *PrivateP2PAPI) RemoveBan(id *string) (interface{}, error)
- func (api *PrivateP2PAPI) ResetPeers() (interface{}, error)
- func (api *PrivateP2PAPI) SetLibp2pLogLevel(level string) (interface{}, error)
- type PublicP2PAPI
- type Rebroadcast
- type Service
- func (s *Service) APIs() []api.API
- func (s *Service) BlockChain() *blockchain.BlockChain
- func (s *Service) BroadcastBlock(block *types.SerializedBlock, source *peer.ID) error
- func (s *Service) BroadcastMessage(data interface{})
- func (s *Service) Config() *common.Config
- func (s *Service) Connect(pi peer.AddrInfo) error
- func (s *Service) ConnectTo(node *qnode.Node)
- func (s *Service) ConnectToPeer(qmaddr string, force bool) error
- func (s *Service) Consensus() model.Consensus
- func (s *Service) Disconnect(pid peer.ID) error
- func (s *Service) Encoding() encoder.NetworkEncoding
- func (s *Service) GetBanlist() map[peer.ID][]*json.BadResponse
- func (s *Service) GetGenesisHash() *hash.Hash
- func (s *Service) Host() host.Host
- func (s *Service) HostAddress() []string
- func (s *Service) HostDNS() multiaddr.Multiaddr
- func (s *Service) IncreaseBytesRecv(pid peer.ID, size int)
- func (s *Service) IncreaseBytesSent(pid peer.ID, size int)
- func (s *Service) InterceptAccept(n network.ConnMultiaddrs) (allow bool)
- func (s *Service) InterceptAddrDial(p peer.ID, m multiaddr.Multiaddr) (allow bool)
- func (s *Service) InterceptPeerDial(p peer.ID) (allow bool)
- func (s *Service) InterceptSecured(_ network.Direction, _ peer.ID, n network.ConnMultiaddrs) (allow bool)
- func (s *Service) InterceptUpgraded(n network.Conn) (allow bool, reason control.DisconnectReason)
- func (s *Service) IsCurrent() bool
- func (s *Service) IsNearlySynced() bool
- func (s *Service) IsRunning() bool
- func (s *Service) KademliaDHTOption() libp2p.Option
- func (s *Service) Metadata() *pb.MetaData
- func (s *Service) MetadataSeq() uint64
- func (s *Service) Node() *qnode.Node
- func (s *Service) Notify() model.Notify
- func (s *Service) PeerID() peer.ID
- func (s *Service) PeerSync() *synch.PeerSync
- func (s *Service) Peers() *peers.Status
- func (s *Service) PubSub() *pubsub.PubSub
- func (s *Service) QNR() *qnr.Record
- func (s *Service) Rebroadcast() *Rebroadcast
- func (s *Service) RefreshQNR()
- func (s *Service) RegainMempool()
- func (s *Service) RelayInventory(nds []*notify.NotifyData)
- func (s *Service) RelayNodeInfo() *peer.AddrInfo
- func (s *Service) RemoveBan(id string)
- func (s *Service) Resolve(n *qnode.Node) *qnode.Node
- func (s *Service) SetBlockChain(blockChain *blockchain.BlockChain)
- func (s *Service) SetNotify(notify model.Notify)
- func (s *Service) SetTimeSource(timeSource model.MedianTimeSource)
- func (s *Service) SetTxMemPool(txMemPool *mempool.TxPool)
- func (s *Service) Start() error
- func (s *Service) Stop() error
- func (s *Service) TimeSource() model.MedianTimeSource
- func (s *Service) TxMemPool() *mempool.TxPool
Constants ¶
const (
MaxRegainMempoolSize = 1000
)
const PeerStore = "peerstore"
Variables ¶
This section is empty.
Functions ¶
func BuildUserAgent ¶
func PrivateKey ¶
func PrivateKey(dataDir string, privateKeyPath string, readWritePermissions os.FileMode) (crypto.PrivKey, error)
Determines a private key for p2p networking from the p2p service's configuration struct. If no key is found, it generates a new one.
func ProtocolDHT ¶
func SerializeQNR ¶
SerializeQNR takes the qnr record in its key-value form and serializes it.
func ToECDSAPrivKey ¶ added in v1.0.20
func ToECDSAPrivKey(privKey crypto.PrivKey) (*ecdsa.PrivateKey, error)
Types ¶
type Listener ¶
type Listener interface { Self() *qnode.Node Close() Lookup(qnode.ID) []*qnode.Node Resolve(*qnode.Node) *qnode.Node RandomNodes() qnode.Iterator Ping(*qnode.Node) error RequestQNR(*qnode.Node) (*qnode.Node, error) LocalNode() *qnode.LocalNode }
Listener defines the discovery V5 network interface that is used to communicate with other peers.
type PrivateP2PAPI ¶
type PrivateP2PAPI struct {
// contains filtered or unexported fields
}
func NewPrivateP2PAPI ¶
func NewPrivateP2PAPI(s *Service) *PrivateP2PAPI
func (*PrivateP2PAPI) AddPeer ¶
func (api *PrivateP2PAPI) AddPeer(qmaddr string) (interface{}, error)
func (*PrivateP2PAPI) Banlist ¶ added in v1.0.21
func (api *PrivateP2PAPI) Banlist() (interface{}, error)
Banlist
func (*PrivateP2PAPI) CheckConsistency ¶ added in v1.0.21
func (api *PrivateP2PAPI) CheckConsistency(hashOrNumber string) (interface{}, error)
func (*PrivateP2PAPI) DelPeer ¶
func (api *PrivateP2PAPI) DelPeer(pid string) (interface{}, error)
func (*PrivateP2PAPI) DisableRelayTx ¶ added in v1.0.21
func (api *PrivateP2PAPI) DisableRelayTx(dis bool) (interface{}, error)
func (*PrivateP2PAPI) Pause ¶
func (api *PrivateP2PAPI) Pause() (interface{}, error)
func (*PrivateP2PAPI) Ping ¶
func (api *PrivateP2PAPI) Ping(addr string, port uint, protocol string) (interface{}, error)
func (*PrivateP2PAPI) ReloadPeers ¶ added in v1.0.20
func (api *PrivateP2PAPI) ReloadPeers() error
Reload All Peers
func (*PrivateP2PAPI) RemoveBan ¶ added in v1.0.21
func (api *PrivateP2PAPI) RemoveBan(id *string) (interface{}, error)
RemoveBan
func (*PrivateP2PAPI) ResetPeers ¶
func (api *PrivateP2PAPI) ResetPeers() (interface{}, error)
func (*PrivateP2PAPI) SetLibp2pLogLevel ¶ added in v1.0.21
func (api *PrivateP2PAPI) SetLibp2pLogLevel(level string) (interface{}, error)
type PublicP2PAPI ¶
type PublicP2PAPI struct {
// contains filtered or unexported fields
}
func NewPublicP2PAPI ¶
func NewPublicP2PAPI(s *Service) *PublicP2PAPI
func (*PublicP2PAPI) GetNetworkInfo ¶ added in v1.0.21
func (api *PublicP2PAPI) GetNetworkInfo() (interface{}, error)
func (*PublicP2PAPI) GetPeerInfo ¶
func (api *PublicP2PAPI) GetPeerInfo(verbose *bool, pid *string) (interface{}, error)
Return the peer info
func (*PublicP2PAPI) IsCurrent ¶ added in v1.0.19
func (api *PublicP2PAPI) IsCurrent() (interface{}, error)
Return IsCurrent
type Rebroadcast ¶
type Rebroadcast struct {
// contains filtered or unexported fields
}
func NewRebroadcast ¶
func NewRebroadcast(s *Service) *Rebroadcast
func (*Rebroadcast) AddInventory ¶
func (r *Rebroadcast) AddInventory(h *hash.Hash, data interface{})
func (*Rebroadcast) RegainMempool ¶
func (r *Rebroadcast) RegainMempool()
func (*Rebroadcast) RemoveInventory ¶
func (r *Rebroadcast) RemoveInventory(hs []*hash.Hash)
func (*Rebroadcast) Start ¶
func (r *Rebroadcast) Start()
func (*Rebroadcast) Stop ¶
func (r *Rebroadcast) Stop() error
type Service ¶
func NewService ¶
func (*Service) BlockChain ¶
func (s *Service) BlockChain() *blockchain.BlockChain
func (*Service) BroadcastBlock ¶ added in v1.2.0
func (*Service) BroadcastMessage ¶
func (s *Service) BroadcastMessage(data interface{})
func (*Service) Disconnect ¶
Disconnect from a peer.
func (*Service) Encoding ¶
func (s *Service) Encoding() encoder.NetworkEncoding
Encoding returns the configured networking encoding.
func (*Service) GetBanlist ¶
func (s *Service) GetBanlist() map[peer.ID][]*json.BadResponse
func (*Service) GetGenesisHash ¶
func (*Service) HostAddress ¶
func (*Service) InterceptAccept ¶
func (s *Service) InterceptAccept(n network.ConnMultiaddrs) (allow bool)
InterceptAccept tests whether an incipient inbound connection is allowed.
func (*Service) InterceptAddrDial ¶
InterceptAddrDial tests whether we're permitted to dial the specified multiaddr for the given peer.
func (*Service) InterceptPeerDial ¶
InterceptPeerDial tests whether we're permitted to Dial the specified peer.
func (*Service) InterceptSecured ¶
func (s *Service) InterceptSecured(_ network.Direction, _ peer.ID, n network.ConnMultiaddrs) (allow bool)
InterceptSecured tests whether a given connection, now authenticated, is allowed.
func (*Service) InterceptUpgraded ¶
InterceptUpgraded tests whether a fully capable connection is allowed.
func (*Service) IsNearlySynced ¶ added in v1.2.0
func (*Service) KademliaDHTOption ¶
func (s *Service) KademliaDHTOption() libp2p.Option
func (*Service) MetadataSeq ¶
MetadataSeq returns the metadata sequence number.
func (*Service) PubSub ¶
func (s *Service) PubSub() *pubsub.PubSub
PubSub returns the p2p pubsub framework.
func (*Service) Rebroadcast ¶
func (s *Service) Rebroadcast() *Rebroadcast
func (*Service) RefreshQNR ¶
func (s *Service) RefreshQNR()
func (*Service) RegainMempool ¶
func (s *Service) RegainMempool()
func (*Service) RelayInventory ¶
func (s *Service) RelayInventory(nds []*notify.NotifyData)
func (*Service) RelayNodeInfo ¶
func (*Service) SetBlockChain ¶
func (s *Service) SetBlockChain(blockChain *blockchain.BlockChain)
func (*Service) SetTimeSource ¶
func (s *Service) SetTimeSource(timeSource model.MedianTimeSource)
func (*Service) SetTxMemPool ¶
func (*Service) TimeSource ¶
func (s *Service) TimeSource() model.MedianTimeSource
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package discover implements the Node Discovery Protocol.
|
Package discover implements the Node Discovery Protocol. |
Package iputils contains useful functions for ip address formatting.
|
Package iputils contains useful functions for ip address formatting. |
Package netutil contains extensions to the net package.
|
Package netutil contains extensions to the net package. |
proto
|
|
v1
Code generated by fastssz.
|
Code generated by fastssz. |