Documentation ¶
Index ¶
- Constants
- func MultiAddrString(i int, port int) string
- func ShortPeerIDString(id peer.ID) string
- type AddressFilter
- type Config
- type ExternalMultiAddresses
- type Peer
- type Peers
- func (ps *Peers) DurationSinceLastMessageFromPeer() time.Duration
- func (ps *Peers) GetPeersInfo() *api.PeersInfo
- func (ps *Peers) GossipTxBytesToPeers(txBytes []byte, metadata *txmetadata.TransactionMetadata, except ...peer.ID)
- func (ps *Peers) Host() host.Host
- func (ps *Peers) IsAlive(id peer.ID) (isAlive bool)
- func (ps *Peers) IsBlacklisted(id peer.ID) (isBlacklisted bool)
- func (ps *Peers) NewStream(peerID peer.ID, pID protocol.ID, timeout time.Duration) (network.Stream, error)
- func (ps *Peers) NumAlive() (aliveStatic, aliveDynamic, pullTargets int)
- func (ps *Peers) OnReceivePullTxRequest(fun func(from peer.ID, txid ledger.TransactionID))
- func (ps *Peers) OnReceiveTxBytes(...)
- func (ps *Peers) PeerName(id peer.ID) string
- func (ps *Peers) PullTransactionsFromNPeers(nPeers int, txid ledger.TransactionID) int
- func (ps *Peers) Run()
- func (ps *Peers) SelfPeerID() peer.ID
- func (ps *Peers) SendTxBytesWithMetadataToPeer(id peer.ID, txBytes []byte, metadata *txmetadata.TransactionMetadata) bool
- func (ps *Peers) Stop()
Constants ¶
View Source
const ( TraceTagHeartBeatRecv = "peering_hb_recv" TraceTagHeartBeatSend = "peering_hb_send" )
View Source
const ( Name = "peers" TraceTag = Name )
View Source
const BeginPort = 4000
View Source
const (
MaxPayloadSize = math.MaxUint16 - 4
)
MaxPayloadSize caps the message size. It includes 4 bytes of the size
View Source
const PullTransactions = byte(iota)
View Source
const TestBlacklistTTL = 20 // ms
View Source
const (
TraceTagAutopeering = "autopeering"
)
View Source
const (
TraceTagPeeringPeers = "peering_peers"
)
View Source
const TraceTagPullTargets = "peering_pull_targets"
Variables ¶
This section is empty.
Functions ¶
func MultiAddrString ¶
func ShortPeerIDString ¶
Types ¶
type AddressFilter ¶
type AddressFilter = func([]multiaddr.Multiaddr) []multiaddr.Multiaddr
func FilterAddresses ¶
func FilterAddresses(allowLocalNetworks bool) AddressFilter
type Config ¶
type Config struct { HostIDPrivateKey ed25519.PrivateKey HostID peer.ID HostPort int PreConfiguredPeers map[string]_multiaddr // name -> PeerAddr. Static peers used also for bootstrap // MaxDynamicPeers if MaxDynamicPeers <= len(PreConfiguredPeers), autopeering is disabled, otherwise up to // MaxDynamicPeers - len(PreConfiguredPeers) will be auto-peered MaxDynamicPeers int // Node info IgnoreAllPullRequests bool AcceptPullRequestsFromStaticPeersOnly bool // AllowLocalIPs defines if local IPs are allowed to be used for autopeering. AllowLocalIPs bool `default:"false" usage:"allow local IPs to be used for autopeering"` // used for testing only. Otherwise, remote peer sets the pull flags ForcePullFromAllPeers bool // timeout for heartbeat. If not set, used special defaultSendHeartbeatTimeout SendTimeoutHeartbeat time.Duration // wait time to allow a blacklisted peer to connect again BlacklistTTL int // wait time after a disconnected peer can be reconnected again CooloffListTTL int // disable Quicreuse DisableQuicreuse bool }
func MakeConfigFor ¶
type ExternalMultiAddresses ¶
type ExternalMultiAddresses []string
type Peers ¶
type Peers struct {
// contains filtered or unexported fields
}
func NewPeersDummy ¶
func NewPeersDummy() *Peers
func NewPeersFromConfig ¶
func (*Peers) DurationSinceLastMessageFromPeer ¶
func (*Peers) GetPeersInfo ¶
func (*Peers) GossipTxBytesToPeers ¶
func (ps *Peers) GossipTxBytesToPeers(txBytes []byte, metadata *txmetadata.TransactionMetadata, except ...peer.ID)
func (*Peers) OnReceivePullTxRequest ¶
func (ps *Peers) OnReceivePullTxRequest(fun func(from peer.ID, txid ledger.TransactionID))
func (*Peers) OnReceiveTxBytes ¶
func (ps *Peers) OnReceiveTxBytes(fun func(from peer.ID, txBytes []byte, metadata *txmetadata.TransactionMetadata, txData []byte))
func (*Peers) PullTransactionsFromNPeers ¶
func (ps *Peers) PullTransactionsFromNPeers(nPeers int, txid ledger.TransactionID) int
PullTransactionsFromNPeers sends pull request to the random peers which has txStore Return number of peer pull request was sent to
func (*Peers) SelfPeerID ¶
func (*Peers) SendTxBytesWithMetadataToPeer ¶
func (ps *Peers) SendTxBytesWithMetadataToPeer(id peer.ID, txBytes []byte, metadata *txmetadata.TransactionMetadata) bool
Click to show internal directories.
Click to hide internal directories.