Documentation ¶
Index ¶
- Constants
- Variables
- type ContextKey
- type PeerInfo
- type PeerList
- func (peerList *PeerList) DeletePPByNetworkAddress(ctx context.Context, networkAddress string)
- func (peerList *PeerList) GetPPByNetworkAddress(ctx context.Context, networkAddress string) *PeerInfo
- func (peerList *PeerList) GetPPByP2pAddress(ctx context.Context, p2pAddress string) *PeerInfo
- func (peerList *PeerList) GetPPList(ctx context.Context) (list []*PeerInfo, total, connected int64)
- func (peerList *PeerList) Init(localNetworkAddress, ppListPath string)
- func (peerList *PeerList) SavePPList(ctx context.Context, target *protos.RspGetPPList) error
- func (peerList *PeerList) SavePPListToFile(ctx context.Context) error
- func (peerList *PeerList) UpdatePP(ctx context.Context, ppNode *PeerInfo)
Constants ¶
View Source
const ( PEER_NOT_CONNECTED = iota PEER_CONNECTED )
View Source
const ( PP_INACTIVE uint32 = iota PP_ACTIVE = 1 PP_UNBONDING = 2 )
Variables ¶
View Source
var ( P2P_SERVER_KEY = ContextKey{Key: "PPServerKey"} LISTEN_OFFLINE_QUIT_CH_KEY = ContextKey{Key: "ListenOfflineQuitCh"} PP_NETWORK_KEY = ContextKey{Key: "PpNetworkKey"} )
Functions ¶
This section is empty.
Types ¶
type ContextKey ¶ added in v0.10.0
type ContextKey struct {
Key string
}
type PeerInfo ¶ added in v0.5.0
type PeerInfo struct { NetworkAddress string P2pAddress string RestAddress string WalletAddress string DiscoveryTime int64 // When was this peer discovered for the first time LastConnectionTime int64 // When was the last time we connected with this peer Latency int64 // The latency in ms ConnetionType string // the network for pp server listen on, 'tcp' or 'tcp4' or 'tcp6' NetId int64 // The ID of the current connection with this node, if it exists. Status int }
type PeerList ¶ added in v0.5.0
type PeerList struct { PpMapByNetworkAddress *sync.Map // map[string]*PeerInfo // contains filtered or unexported fields }
func (*PeerList) DeletePPByNetworkAddress ¶ added in v0.5.0
func (*PeerList) GetPPByNetworkAddress ¶ added in v0.5.0
func (*PeerList) GetPPByP2pAddress ¶ added in v0.5.0
func (*PeerList) SavePPList ¶ added in v0.5.0
func (*PeerList) SavePPListToFile ¶ added in v0.9.0
Click to show internal directories.
Click to hide internal directories.