transport

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqLeagueJoinOK = iota
	ResLeagueJoinFalse
	SendEnode
	SendOTPRN
	SendLeageNodeList
	MakeJoinTx
	MakeBlock
	MinerLeageStop
	SendBlockForVote
	SendFinalBlock
	FinishLeague
	RequestWinningBlock
	SendWinningBlock
	WinningBlockVote
)

Variables

This section is empty.

Functions

func Send

func Send(w MsgWriter, code uint32, data interface{}) error

func SendUDP

func SendUDP(msgcode uint32, data interface{}, conn net.Conn) error

Types

type MsgReadWriter

type MsgReadWriter interface {
	MsgReader
	MsgWriter
}

type MsgReader

type MsgReader interface {
	ReadMsg() (*TsMsg, error)
}

type MsgWriter

type MsgWriter interface {
	WriteMsg(*TsMsg) error
}

type Transport

type Transport interface {
	MsgReadWriter
	Close()
}

func New

func New(fd net.Conn) Transport

type TsMsg

type TsMsg struct {
	Code       uint32
	Size       uint32
	Payload    []byte
	ReceivedAt time.Time
}

func MakeTsMsg

func MakeTsMsg(msgcode uint32, data interface{}) (*TsMsg, error)

func ReadUDP

func ReadUDP(msg []byte) *TsMsg

func (*TsMsg) Decode

func (m *TsMsg) Decode(val interface{}) error

func (*TsMsg) Discard

func (m *TsMsg) Discard() error

func (*TsMsg) EncodeToByte

func (m *TsMsg) EncodeToByte() ([]byte, error)

type Tsp

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

func (*Tsp) Close

func (t *Tsp) Close()

func (*Tsp) ReadMsg

func (t *Tsp) ReadMsg() (*TsMsg, error)

func (*Tsp) WriteMsg

func (t *Tsp) WriteMsg(msg *TsMsg) error

Jump to

Keyboard shortcuts

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