peer

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: LGPL-3.0 Imports: 13 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	Info *PeerInfo
	Link *conn.Link
	// contains filtered or unexported fields
}

Peer represent the node in p2p

func NewPeer

func NewPeer(info *PeerInfo, c net.Conn, msgChan chan *types.MsgPayload) *Peer

NewPeer return new peer without publickey initial

func (*Peer) Close added in v1.6.2

func (this *Peer) Close()

Close halt sync connection

func (*Peer) DumpInfo

func (this *Peer) DumpInfo()

DumpInfo print all information of peer

func (*Peer) GetAddr

func (this *Peer) GetAddr() string

GetAddr return peer`s sync link address

func (*Peer) GetAddr16

func (this *Peer) GetAddr16() ([16]byte, error)

GetAddr16 return peer`s sync link address in []byte

func (*Peer) GetContactTime

func (this *Peer) GetContactTime() time.Time

GetContactTime return peer`s latest contact time in Time struct

func (*Peer) GetHeight

func (this *Peer) GetHeight() uint64

GetHeight return peer`s block height

func (*Peer) GetHttpInfoPort

func (this *Peer) GetHttpInfoPort() uint16

GetHttpInfoPort return peer`s httpinfo port

func (*Peer) GetID

func (this *Peer) GetID() common.PeerId

GetID return peer`s id

func (*Peer) GetPort added in v1.6.2

func (this *Peer) GetPort() uint16

GetPort return Peer`s sync port

func (*Peer) GetRelay

func (this *Peer) GetRelay() bool

GetRelay return peer`s relay state

func (*Peer) GetServices

func (this *Peer) GetServices() uint64

GetServices return peer`s service state

func (*Peer) GetSoftVersion added in v1.6.0

func (this *Peer) GetSoftVersion() string

func (*Peer) GetTimeStamp

func (this *Peer) GetTimeStamp() int64

GetTimeStamp return peer`s latest contact time in ticks

func (*Peer) GetVersion

func (this *Peer) GetVersion() uint32

GetVersion return peer`s version

func (*Peer) Send

func (this *Peer) Send(msg types.Message) error

Send transfer buffer by sync or cons link

func (*Peer) SendRaw added in v1.6.0

func (this *Peer) SendRaw(msgType string, msgPayload []byte) error

SendTo call sync link to send buffer

func (*Peer) SetHeight

func (this *Peer) SetHeight(height uint64)

SetHeight set height to peer

type PeerInfo added in v1.10.0

type PeerInfo struct {
	Id           common.PeerId
	Version      uint32
	Services     uint64
	Relay        bool
	HttpInfoPort uint16
	Port         uint16
	SoftVersion  string
	Addr         string
	// contains filtered or unexported fields
}

PeerInfo provides the basic information of a peer

func NewPeerInfo added in v1.10.0

func NewPeerInfo(id common.PeerId, version uint32, services uint64, relay bool, httpInfoPort uint16,
	port uint16, height uint64, softVersion string, addr string) *PeerInfo

func (*PeerInfo) Height added in v1.10.0

func (self *PeerInfo) Height() uint64

func (*PeerInfo) RemoteListenAddress added in v1.10.0

func (pi *PeerInfo) RemoteListenAddress() string

RemoteListen get remote service port

func (*PeerInfo) SetHeight added in v1.12.0

func (self *PeerInfo) SetHeight(height uint64)

func (*PeerInfo) String added in v1.10.0

func (self *PeerInfo) String() string

Jump to

Keyboard shortcuts

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