client

package
v0.0.0-...-3f94a61 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_NOT_FOUND_PEERS_LIMIT = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Ws            *websocket.Conn
	MessageType   int
	PeerId        string //唯一标识
	LocalNode     bool   // 是否本地节点
	Timestamp     int64
	NotFoundPeers []string // 记录没有找到的peer的队列
}

func New

func New(peerId string, ws *websocket.Conn, localNode bool) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) EnqueueNotFoundPeer

func (c *Client) EnqueueNotFoundPeer(id string)

func (*Client) HasNotFoundPeer

func (c *Client) HasNotFoundPeer(id string) bool

func (*Client) IsExpired

func (c *Client) IsExpired(now, limit int64) bool

func (*Client) SendMessage

func (c *Client) SendMessage(msg []byte) error

func (*Client) SendMsgVersion

func (c *Client) SendMsgVersion(version int) error

func (*Client) SetMT

func (c *Client) SetMT(mt int)

func (*Client) UpdateTs

func (c *Client) UpdateTs()

type SignalVerResponse

type SignalVerResponse struct {
	Action string `json:"action"`
	Ver    int    `json:"ver"`
}

Jump to

Keyboard shortcuts

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