types

package
v0.11.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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
}

func (*PeerInfo) String added in v0.5.0

func (peerInfo *PeerInfo) String() string

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 *PeerList) DeletePPByNetworkAddress(ctx context.Context, networkAddress string)

func (*PeerList) GetPPByNetworkAddress added in v0.5.0

func (peerList *PeerList) GetPPByNetworkAddress(ctx context.Context, networkAddress string) *PeerInfo

func (*PeerList) GetPPByP2pAddress added in v0.5.0

func (peerList *PeerList) GetPPByP2pAddress(ctx context.Context, p2pAddress string) *PeerInfo

func (*PeerList) GetPPList added in v0.5.0

func (peerList *PeerList) GetPPList(ctx context.Context) (list []*PeerInfo, total, connected int64)

func (*PeerList) Init added in v0.5.0

func (peerList *PeerList) Init(localNetworkAddress, ppListPath string)

func (*PeerList) SavePPList added in v0.5.0

func (peerList *PeerList) SavePPList(ctx context.Context, target *protos.RspGetPPList) error

func (*PeerList) SavePPListToFile added in v0.9.0

func (peerList *PeerList) SavePPListToFile(ctx context.Context) error

func (*PeerList) UpdatePP added in v0.5.0

func (peerList *PeerList) UpdatePP(ctx context.Context, ppNode *PeerInfo)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL