gossip

package
v0.0.0-...-268552a Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Overview

Package gossip 实现了gossip网络拓扑

Package gossip ...

Index

Constants

View Source
const (
	DefaultLtTxBroadCastTTL  = 3
	DefaultMaxTxBroadCastTTL = 25
)

TTL

View Source
const (
	PeerAddrCacheNum = 1000
	//接收的交易哈希过滤缓存设为mempool最大接收交易量
	TxRecvFilterCacheNum = 10240
	BlockFilterCacheNum  = 50
	//发送过滤主要用于发送时冗余检测, 发送完即可以被删除, 维护较小缓存数
	TxSendFilterCacheNum  = 500
	BlockCacheNum         = 10
	MaxBlockCacheByteSize = 100 * 1024 * 1024
)

P2pCacheTxSize p2pcache size of transaction

View Source
const P2PTypeName = "gossip"

P2PTypeName p2p plugin name for gossip

View Source
const (
	// Service service number
	Service int32 = nodeBloom + nodeNetwork + nodeGetUTXO
)
View Source
const VERSION = lightBroadCastVersion

VERSION number

Variables

View Source
var (
	UpdateState        = 2 * time.Second
	PingTimeout        = 14 * time.Second
	DefaultSendTimeout = 10 * time.Second
	DialTimeout        = 5 * time.Second

	StreamPingTimeout           = 20 * time.Second
	MonitorPeerInfoInterval     = 10 * time.Second
	MonitorPeerNumInterval      = 30 * time.Second
	MonitorReBalanceInterval    = 15 * time.Minute
	GetAddrFromAddrBookInterval = 5 * time.Second
	GetAddrFromOnlineInterval   = 5 * time.Second
	GetAddrFromGitHubInterval   = 5 * time.Minute
	CheckActivePeersInterVal    = 5 * time.Second
	CheckBlackListInterVal      = 30 * time.Second
	CheckCfgSeedsInterVal       = 1 * time.Minute
)

time limit for timeout

View Source
var MainNetSeeds = []string{
	"39.105.112.116:9675",
	"101.200.37.68:9675",
}

MainNetSeeds built-in list of seed

View Source
var TestNetSeeds = []string{
	"47.97.223.101:9675",
}

TestNetSeeds test seeds of net

Functions

func New

func New(mgr *p2p.Manager, subCfg []byte) p2p.IP2P

New produce a p2p object

Types

type AddrBook

type AddrBook struct {
	Quit chan struct{}
	// contains filtered or unexported fields
}

AddrBook peer address manager

func NewAddrBook

func NewAddrBook(cfg *types.P2P, subCfg *subConfig) *AddrBook

NewAddrBook create a addrbook

func (*AddrBook) AddAddress

func (a *AddrBook) AddAddress(addr *NetAddress, ka *KnownAddress)

AddAddress add a address for ours NOTE: addr must not be nil

func (*AddrBook) AddOurAddress

func (a *AddrBook) AddOurAddress(addr *NetAddress)

AddOurAddress add a address for ours

func (*AddrBook) Close

func (a *AddrBook) Close()

Close addrbook close

func (*AddrBook) GetAddrs

func (a *AddrBook) GetAddrs() []string

GetAddrs return addrlist

func (*AddrBook) GetPeerStat

func (a *AddrBook) GetPeerStat(addr string) *KnownAddress

GetPeerStat get peer stat

func (*AddrBook) GetPeers

func (a *AddrBook) GetPeers() []*NetAddress

GetPeers return peerlist

func (*AddrBook) GetPrivPubKey

func (a *AddrBook) GetPrivPubKey() (string, string)

GetPrivPubKey return privkey and pubkey

func (*AddrBook) ISOurAddress

func (a *AddrBook) ISOurAddress(addr *NetAddress) bool

ISOurAddress determine if the address is ours

func (*AddrBook) IsOurStringAddress

func (a *AddrBook) IsOurStringAddress(addr string) bool

IsOurStringAddress determine if the address is ours

func (*AddrBook) RemoveAddr

func (a *AddrBook) RemoveAddr(peeraddr string)

RemoveAddr remove address

func (*AddrBook) ResetPeerkey

func (a *AddrBook) ResetPeerkey(privkey, pubkey string)

ResetPeerkey reset priv,pub key

func (*AddrBook) Save

func (a *AddrBook) Save()

Save saves the book.

func (*AddrBook) Size

func (a *AddrBook) Size() int

Size return addrpeer size

func (*AddrBook) Start

func (a *AddrBook) Start() error

Start addrbook start

type BlackList

type BlackList struct {
	// contains filtered or unexported fields
}

BlackList badpeers list

func (*BlackList) Add

func (bl *BlackList) Add(addr string, deadline int64)

Add add badpeer

func (*BlackList) Delete

func (bl *BlackList) Delete(addr string)

Delete delete badpeer

func (*BlackList) GetBadPeers

func (bl *BlackList) GetBadPeers() map[string]int64

GetBadPeers reurn black list peers

func (*BlackList) Has

func (bl *BlackList) Has(addr string) bool

Has the badpeer true and false

type Cli

type Cli struct {
	// contains filtered or unexported fields
}

Cli p2p client

func (*Cli) BlockBroadcast

func (m *Cli) BlockBroadcast(msg *queue.Message, taskindex int64)

BlockBroadcast block broadcast

func (*Cli) BroadCastTx

func (m *Cli) BroadCastTx(msg *queue.Message, taskindex int64)

BroadCastTx broadcast transactions

func (*Cli) CheckPeerNatOk

func (m *Cli) CheckPeerNatOk(addr string, info *NodeInfo) bool

CheckPeerNatOk check peer is ok or not

func (*Cli) CheckSelf

func (m *Cli) CheckSelf(addr string, nodeinfo *NodeInfo) bool

CheckSelf check addrbook privPubKey

func (*Cli) GetAddr

func (m *Cli) GetAddr(peer *Peer) ([]string, error)

GetAddr get address list

func (*Cli) GetAddrList

func (m *Cli) GetAddrList(peer *Peer) (map[string]int64, error)

GetAddrList return a map for address-prot

func (*Cli) GetBlockHeight

func (m *Cli) GetBlockHeight(nodeinfo *NodeInfo) (int64, error)

GetBlockHeight return block height

func (*Cli) GetBlocks

func (m *Cli) GetBlocks(msg *queue.Message, taskindex int64)

GetBlocks get blocks information

func (*Cli) GetHeaders

func (m *Cli) GetHeaders(msg *queue.Message, taskindex int64)

GetHeaders get headers information

func (*Cli) GetInPeersNum

func (m *Cli) GetInPeersNum(peer *Peer) (int, error)

GetInPeersNum return normal number of peers

func (*Cli) GetMemPool

func (m *Cli) GetMemPool(msg *queue.Message, taskindex int64)

GetMemPool get mempool contents

func (*Cli) GetNetInfo

func (m *Cli) GetNetInfo(msg *queue.Message, taskindex int64)

GetNetInfo get network information

func (*Cli) GetPeerInfo

func (m *Cli) GetPeerInfo(msg *queue.Message, taskindex int64)

GetPeerInfo return peer information

func (*Cli) SendPing

func (m *Cli) SendPing(peer *Peer, nodeinfo *NodeInfo) error

SendPing send ping

func (*Cli) SendVersion

func (m *Cli) SendVersion(peer *Peer, nodeinfo *NodeInfo) (string, error)

SendVersion send version

type Comm

type Comm struct{}

Comm information

var P2pComm Comm

P2pComm p2p communication

func (Comm) AddrRouteble

func (Comm) AddrRouteble(addrs []string, version int32, creds credentials.TransportCredentials) []string

AddrRouteble address router ,return enbale address

func (Comm) BytesToInt32

func (c Comm) BytesToInt32(b []byte) int32

BytesToInt32 bytes to int32 type

func (Comm) CheckSign

func (c Comm) CheckSign(in *types.P2PPing) bool

CheckSign check signature data

func (Comm) CollectPeerStat

func (c Comm) CollectPeerStat(err error, peer *Peer)

CollectPeerStat collect peer stat and report

func (Comm) GenPrivPubkey

func (c Comm) GenPrivPubkey() ([]byte, []byte, error)

GenPrivPubkey return key and pubkey in bytes

func (Comm) GetLocalAddr

func (c Comm) GetLocalAddr() string

GetLocalAddr get local address ,return address

func (Comm) GrpcConfig

func (c Comm) GrpcConfig() grpc.ServiceConfig

GrpcConfig grpc config

func (Comm) Int32ToBytes

func (c Comm) Int32ToBytes(n int32) []byte

Int32ToBytes int32 to bytes type

func (Comm) NewPingData

func (c Comm) NewPingData(nodeInfo *NodeInfo) (*types.P2PPing, error)

NewPingData get ping node ,return p2pping

func (Comm) Pubkey

func (c Comm) Pubkey(key string) (string, error)

Pubkey get pubkey by priv key

func (Comm) RandStr

func (c Comm) RandStr(n int) string

RandStr return a rand string

func (Comm) Signature

func (c Comm) Signature(key string, in *types.P2PPing) (*types.P2PPing, error)

Signature nodedata by key

type DownloadJob

type DownloadJob struct {
	MaxJob int32
	// contains filtered or unexported fields
}

DownloadJob defines download job type

func NewDownloadJob

func NewDownloadJob(p2pcli *Cli, peers []*Peer) *DownloadJob

NewDownloadJob create a downloadjob object

func (*DownloadJob) CancelJob

func (d *DownloadJob) CancelJob()

CancelJob cancel the downloadjob object

func (*DownloadJob) DownloadBlock

func (d *DownloadJob) DownloadBlock(invs []*pb.Inventory,
	bchan chan *pb.BlockPid) []*pb.Inventory

DownloadBlock download the block

func (*DownloadJob) GetFreePeer

func (d *DownloadJob) GetFreePeer(blockHeight int64) *Peer

GetFreePeer get free peer ,return peer

func (*DownloadJob) ResetDownloadPeers

func (d *DownloadJob) ResetDownloadPeers(peers []*Peer)

ResetDownloadPeers reset download peers

type EventInterface

type EventInterface interface {
	BroadCastTx(msg *queue.Message, taskindex int64)
	GetMemPool(msg *queue.Message, taskindex int64)
	GetPeerInfo(msg *queue.Message, taskindex int64)
	GetHeaders(msg *queue.Message, taskindex int64)
	GetBlocks(msg *queue.Message, taskindex int64)
	BlockBroadcast(msg *queue.Message, taskindex int64)
	GetNetInfo(msg *queue.Message, taskindex int64)
}

EventInterface p2p subscribe to the event hander interface

func NewP2PCli

func NewP2PCli(network *P2p) EventInterface

NewP2PCli produce a p2p client

type Invs

type Invs []*pb.Inventory

Invs datastruct

func (Invs) Len

func (i Invs) Len() int

Len size of the Invs data

func (Invs) Less

func (i Invs) Less(a, b int) bool

Less Sort from low to high

func (Invs) Swap

func (i Invs) Swap(a, b int)

Swap the param

type KnownAddress

type KnownAddress struct {
	Addr        *NetAddress `json:"addr"`
	Attempts    uint        `json:"attempts"`
	LastAttempt time.Time   `json:"lastattempt"`
	LastSuccess time.Time   `json:"lastsuccess"`
	// contains filtered or unexported fields
}

KnownAddress defines known address type

func (*KnownAddress) Copy

func (ka *KnownAddress) Copy() *KnownAddress

Copy a KnownAddress

func (*KnownAddress) GetAttempts

func (ka *KnownAddress) GetAttempts() uint

GetAttempts return attempts

type Listener

type Listener interface {
	Close1()
	Start()
}

Listener the actions

type MConnection

type MConnection struct {
	// contains filtered or unexported fields
}

MConnection contains node, grpc client, p2pgserviceClient, netaddress, peer

func NewMConnection

func NewMConnection(conn *grpc.ClientConn, remote *NetAddress, peer *Peer) *MConnection

NewMConnection wraps net.Conn and creates multiplex connection

func (*MConnection) Close

func (c *MConnection) Close()

Close mconnection

type NetAddress

type NetAddress struct {
	IP   net.IP
	Port uint16
	// contains filtered or unexported fields
}

NetAddress defines information about a peer on the network including its IP address, and port.

func NewNetAddress

func NewNetAddress(addr net.Addr) *NetAddress

NewNetAddress returns a new NetAddress using the provided TCP address.

func NewNetAddressIPPort

func NewNetAddressIPPort(ip net.IP, port uint16) *NetAddress

NewNetAddressIPPort returns a new NetAddress using the provided IP and port number.

func NewNetAddressString

func NewNetAddressString(addr string) (*NetAddress, error)

NewNetAddressString returns a new NetAddress using the provided address in the form of "IP:Port". Also resolves the host if host is not an IP.

func NewNetAddressStrings

func NewNetAddressStrings(addrs []string) ([]*NetAddress, error)

NewNetAddressStrings returns an array of NetAddress'es build using the provided strings.

func (*NetAddress) Copy

func (na *NetAddress) Copy() *NetAddress

Copy na address

func (*NetAddress) DialTimeout

func (na *NetAddress) DialTimeout(version int32, creds credentials.TransportCredentials) (*grpc.ClientConn, error)

DialTimeout dial timeout

func (*NetAddress) Equals

func (na *NetAddress) Equals(other interface{}) bool

Equals reports whether na and other are the same addresses.

func (*NetAddress) Less

func (na *NetAddress) Less(other interface{}) bool

Less reports whether na and other are the less addresses

func (*NetAddress) String

func (na *NetAddress) String() string

String representation.

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node attribute

func NewNode

func NewNode(mgr *p2p.Manager, mcfg *subConfig) (*Node, error)

NewNode produce a node object

func (*Node) AddCachePeer

func (n *Node) AddCachePeer(pr *Peer)

AddCachePeer add cacheBound map by addr

func (*Node) CacheBoundsSize

func (n *Node) CacheBoundsSize() int

CacheBoundsSize return node cachebount size

func (*Node) Close

func (n *Node) Close()

Close node server

func (*Node) GetActivePeers

func (n *Node) GetActivePeers() (map[string]*Peer, map[string]*types.Peer)

GetActivePeers return activities of the peers and infos

func (*Node) GetCacheBounds

func (n *Node) GetCacheBounds() []*Peer

GetCacheBounds get node cachebounds

func (*Node) GetRegisterPeer

func (n *Node) GetRegisterPeer(paddr string) *Peer

GetRegisterPeer return one peer according to paddr

func (*Node) GetRegisterPeers

func (n *Node) GetRegisterPeers() []*Peer

GetRegisterPeers return peers

func (*Node) Has

func (n *Node) Has(paddr string) bool

Has peer whether exists according to address

func (*Node) HasCacheBound

func (n *Node) HasCacheBound(addr string) bool

HasCacheBound peer whether exists according to address

func (*Node) RemoveCachePeer

func (n *Node) RemoveCachePeer(addr string)

RemoveCachePeer remove cacheBound by addr

func (*Node) SetQueueClient

func (n *Node) SetQueueClient(client queue.Client)

SetQueueClient return client for nodeinfo

func (*Node) Size

func (n *Node) Size() int

Size return size for peersize

func (*Node) Start

func (n *Node) Start()

Start Node server

type NodeInfo

type NodeInfo struct {
	ServiceType int32
	// contains filtered or unexported fields
}

NodeInfo is interface object of the node

func NewNodeInfo

func NewNodeInfo(p2pCfg *types.P2P, subCfg *subConfig) *NodeInfo

NewNodeInfo new a node object

func (*NodeInfo) FetchPeerInfo

func (nf *NodeInfo) FetchPeerInfo(n *Node)

FetchPeerInfo get peerinfo by node

func (*NodeInfo) Get

func (nf *NodeInfo) Get() *NodeInfo

Get return nodeinfo

func (*NodeInfo) GetExternalAddr

func (nf *NodeInfo) GetExternalAddr() *NetAddress

GetExternalAddr return external address

func (*NodeInfo) GetListenAddr

func (nf *NodeInfo) GetListenAddr() *NetAddress

GetListenAddr return listen address

func (*NodeInfo) IsNatDone

func (nf *NodeInfo) IsNatDone() bool

IsNatDone return ture and false

func (*NodeInfo) IsOutService

func (nf *NodeInfo) IsOutService() bool

IsOutService return true and false for out service

func (*NodeInfo) OutSide

func (nf *NodeInfo) OutSide() bool

OutSide return true and false for outside

func (*NodeInfo) ServiceTy

func (nf *NodeInfo) ServiceTy() int32

ServiceTy return serveice type

func (*NodeInfo) Set

func (nf *NodeInfo) Set(n *NodeInfo)

Set modidy nodeinfo by nodeinfo

func (*NodeInfo) SetExternalAddr

func (nf *NodeInfo) SetExternalAddr(addr *NetAddress)

SetExternalAddr modidy address of the nodeinfo

func (*NodeInfo) SetListenAddr

func (nf *NodeInfo) SetListenAddr(addr *NetAddress)

SetListenAddr modify listen address

func (*NodeInfo) SetNatDone

func (nf *NodeInfo) SetNatDone()

SetNatDone modify natdone

func (*NodeInfo) SetNetSide

func (nf *NodeInfo) SetNetSide(ok bool)

SetNetSide set net side

func (*NodeInfo) SetServiceTy

func (nf *NodeInfo) SetServiceTy(ty int32)

SetServiceTy set service type

type NormalInterface

type NormalInterface interface {
	GetAddr(peer *Peer) ([]string, error)
	SendVersion(peer *Peer, nodeinfo *NodeInfo) (string, error)
	SendPing(peer *Peer, nodeinfo *NodeInfo) error
	GetBlockHeight(nodeinfo *NodeInfo) (int64, error)
	CheckPeerNatOk(addr string, nodeInfo *NodeInfo) bool
	GetAddrList(peer *Peer) (map[string]int64, error)
	GetInPeersNum(peer *Peer) (int, error)
	CheckSelf(addr string, nodeinfo *NodeInfo) bool
}

NormalInterface subscribe to the event hander interface

func NewNormalP2PCli

func NewNormalP2PCli() NormalInterface

NewNormalP2PCli produce a normal client

type P2p

type P2p struct {
	// contains filtered or unexported fields
}

P2p interface

func (*P2p) CloseP2P

func (network *P2p) CloseP2P()

CloseP2P Close network client

func (*P2p) ReStart

func (network *P2p) ReStart()

ReStart p2p

func (*P2p) StartP2P

func (network *P2p) StartP2P()

StartP2P set the queue

func (*P2p) Wait

func (network *P2p) Wait()

Wait wait for ready

type P2pserver

type P2pserver struct {
	// contains filtered or unexported fields
}

P2pserver object information

func NewP2pServer

func NewP2pServer() *P2pserver

NewP2pServer produce a p2pserver

func (*P2pserver) BroadCastBlock

func (s *P2pserver) BroadCastBlock(ctx context.Context, in *pb.P2PBlock) (*pb.Reply, error)

BroadCastBlock broadcast block of p2pserver

func (*P2pserver) BroadCastTx

func (s *P2pserver) BroadCastTx(ctx context.Context, in *pb.P2PTx) (*pb.Reply, error)

BroadCastTx broadcast transactions of p2pserver

func (*P2pserver) Close

func (s *P2pserver) Close()

Close p2pserver close

func (*P2pserver) CollectInPeers

func (s *P2pserver) CollectInPeers(ctx context.Context, in *pb.P2PPing) (*pb.PeerList, error)

CollectInPeers collect external network nodes of connect their own

func (*P2pserver) CollectInPeers2

func (s *P2pserver) CollectInPeers2(ctx context.Context, in *pb.P2PPing) (*pb.PeersReply, error)

CollectInPeers2 collect external network nodes of connect their own

func (*P2pserver) GetAddr

func (s *P2pserver) GetAddr(ctx context.Context, in *pb.P2PGetAddr) (*pb.P2PAddr, error)

GetAddr get address

func (*P2pserver) GetAddrList

func (s *P2pserver) GetAddrList(ctx context.Context, in *pb.P2PGetAddr) (*pb.P2PAddrList, error)

GetAddrList get address list , and height of address

func (*P2pserver) GetBlocks

func (s *P2pserver) GetBlocks(ctx context.Context, in *pb.P2PGetBlocks) (*pb.P2PInv, error)

GetBlocks get blocks of p2pserver

func (*P2pserver) GetData

func (s *P2pserver) GetData(in *pb.P2PGetData, stream pb.P2Pgservice_GetDataServer) error

GetData get data of p2pserver

func (*P2pserver) GetHeaders

func (s *P2pserver) GetHeaders(ctx context.Context, in *pb.P2PGetHeaders) (*pb.P2PHeaders, error)

GetHeaders ger headers of p2pServer

func (*P2pserver) GetMemPool

func (s *P2pserver) GetMemPool(ctx context.Context, in *pb.P2PGetMempool) (*pb.P2PInv, error)

GetMemPool p2pserver queries the local mempool

func (*P2pserver) GetPeerInfo

func (s *P2pserver) GetPeerInfo(ctx context.Context, in *pb.P2PGetPeerInfo) (*pb.P2PPeerInfo, error)

GetPeerInfo get peer information of p2pServer

func (*P2pserver) IsClose

func (s *P2pserver) IsClose() bool

IsClose is p2pserver running

func (*P2pserver) Ping

func (s *P2pserver) Ping(ctx context.Context, in *pb.P2PPing) (*pb.P2PPong, error)

Ping p2pserver ping

func (*P2pserver) ServerStreamRead

func (s *P2pserver) ServerStreamRead(stream pb.P2Pgservice_ServerStreamReadServer) error

ServerStreamRead server stream read of p2pserver

func (*P2pserver) ServerStreamSend

func (s *P2pserver) ServerStreamSend(in *pb.P2PPing, stream pb.P2Pgservice_ServerStreamSendServer) error

ServerStreamSend serverstream send of p2pserver

func (*P2pserver) SoftVersion

func (s *P2pserver) SoftVersion(ctx context.Context, in *pb.P2PPing) (*pb.Reply, error)

SoftVersion software version

func (*P2pserver) Start

func (s *P2pserver) Start()

Start p2pserver start

func (*P2pserver) Version

func (s *P2pserver) Version(ctx context.Context, in *pb.P2PVersion) (*pb.P2PVerAck, error)

Version version

func (*P2pserver) Version2

func (s *P2pserver) Version2(ctx context.Context, in *pb.P2PVersion) (*pb.P2PVersion, error)

Version2 p2pserver version

type Peer

type Peer struct {
	IsMaxInbouds bool
	// contains filtered or unexported fields
}

Peer object information

func NewPeer

func NewPeer(conn *grpc.ClientConn, node *Node, remote *NetAddress) *Peer

NewPeer produce a peer object

func (*Peer) Addr

func (p *Peer) Addr() string

Addr returns peer's remote network address.

func (*Peer) Close

func (p *Peer) Close()

Close peer close

func (*Peer) GetInBouns

func (p *Peer) GetInBouns() int32

GetInBouns get inbounds of peer

func (*Peer) GetPeerInfo

func (p *Peer) GetPeerInfo() (*pb.P2PPeerInfo, error)

GetPeerInfo get peer information of peer

func (*Peer) GetPeerName

func (p *Peer) GetPeerName() string

GetPeerName get name of peer

func (*Peer) GetRunning

func (p *Peer) GetRunning() bool

GetRunning get running ok or not

func (*Peer) IsPersistent

func (p *Peer) IsPersistent() bool

IsPersistent returns true if the peer is persitent, false otherwise.

func (*Peer) MakePersistent

func (p *Peer) MakePersistent()

MakePersistent marks the peer as persistent.

func (*Peer) SetAddr

func (p *Peer) SetAddr(addr *NetAddress)

SetAddr set address of peer

func (*Peer) SetPeerName

func (p *Peer) SetPeerName(name string)

SetPeerName set name of peer

func (*Peer) Start

func (p *Peer) Start()

Start peer start

type PeerInfos

type PeerInfos struct {
	// contains filtered or unexported fields
}

PeerInfos encapsulation peer information

func (*PeerInfos) FlushPeerInfos

func (p *PeerInfos) FlushPeerInfos(in []*types.Peer)

FlushPeerInfos flush peer information

func (*PeerInfos) GetPeerInfo

func (p *PeerInfos) GetPeerInfo(peerName string) *types.Peer

GetPeerInfo return a infos by key

func (*PeerInfos) GetPeerInfos

func (p *PeerInfos) GetPeerInfos() map[string]*types.Peer

GetPeerInfos return a map for peerinfos

func (*PeerInfos) PeerSize

func (p *PeerInfos) PeerSize() int

PeerSize return a size of peer information

func (*PeerInfos) SetPeerInfo

func (p *PeerInfos) SetPeerInfo(peer *types.Peer)

SetPeerInfo modify peer infos

type Stat

type Stat struct {
	// contains filtered or unexported fields
}

Stat object information

func (*Stat) IsOk

func (st *Stat) IsOk() bool

IsOk start is ok or not

func (*Stat) NotOk

func (st *Stat) NotOk()

NotOk start is not ok

func (*Stat) Ok

func (st *Stat) Ok()

Ok start is ok

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version version object information

func (*Version) GetVersion

func (v *Version) GetVersion() int32

GetVersion get version number

func (*Version) IsSupport

func (v *Version) IsSupport() bool

IsSupport is support version

func (*Version) SetSupport

func (v *Version) SetSupport(ok bool)

SetSupport set support of version

func (*Version) SetVersion

func (v *Version) SetVersion(ver int32)

SetVersion set version number

Directories

Path Synopsis
Package nat provides access to common network port mapping protocols.
Package nat provides access to common network port mapping protocols.

Jump to

Keyboard shortcuts

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