link

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDisconnected added in v1.0.2

func NewDisconnected() *types.TransferMsg

Types

type Link struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Link used to establish

func NewLink(lg *logrus.Logger) *Link

func (*Link) CloseConn

func (this *Link) CloseConn()

close connection

func (*Link) GetAddr

func (this *Link) GetAddr() string

get address

func (*Link) GetConn

func (this *Link) GetConn() net.Conn

get connection

func (*Link) GetID

func (this *Link) GetID() uint64

GetID return if from peer

func (*Link) GetPort

func (this *Link) GetPort() uint32

get port number

func (*Link) GetRXTime

func (this *Link) GetRXTime() time.Time

GetRXTime return the latest message time

func (*Link) Rx

func (this *Link) Rx(magic uint32)

func (*Link) SendMessage added in v1.0.2

func (this *Link) SendMessage(msg types.Message) error

func (*Link) SetAddr

func (this *Link) SetAddr(addr string)

set address

func (*Link) SetChan

func (this *Link) SetChan(msgchan chan *types.MsgPayload)

set message channel for link layer

func (*Link) SetConn

func (this *Link) SetConn(conn net.Conn)

set connection

func (*Link) SetID

func (this *Link) SetID(id uint64)

SetID set peer id to link

func (*Link) SetPort

func (this *Link) SetPort(p uint32)

set port number

func (*Link) StopRecvMessage added in v1.0.2

func (this *Link) StopRecvMessage()

func (*Link) StopSendMessage added in v1.0.2

func (this *Link) StopSendMessage()

func (*Link) Tx

func (this *Link) Tx(magic uint32)

func (*Link) UpdateRXTime

func (this *Link) UpdateRXTime(t time.Time)

record latest message time

func (*Link) Valid

func (this *Link) Valid() bool

If there is connection return true

Jump to

Keyboard shortcuts

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