name_server

package
v0.0.0-...-0dc16ad Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Registyer uint8 = iota
	// GetNode      // todo 删除此协议,只有合法用户才可以获取;在登录到目标节点时,还要使用密码,一次使用,终身有效。
	// 不使用token,因为没必要,只使用一次,不是每次请求都使用
	GetNode // login
	NodeInfo
	Error
)
View Source
const (
	ErrDataUnKnow uint32 = iota
)
View Source
const HeadLen = 1 + 1

HeadLen dataLen 1,protoID 1

View Source
const MaxPacketSize uint8 = 255

MaxPacketSize MaxPacketSize

Variables

This section is empty.

Functions

func Pack

func Pack(protoID uint8, dataBytes []byte) (out []byte, err error)

Types

type Message

type Message struct {
	DataLen uint8  // 消息的长度 (1 字节)
	ProtoID uint8  // 协议ID (1 字节)
	Data    []byte // 消息的内容
}

func Unpack

func Unpack(conn *net.TCPConn) (*Message, error)

func UnpackData

func UnpackData(conn *net.TCPConn, msg *Message) (*Message, error)

func UnpackHead

func UnpackHead(conn *net.TCPConn) (msg *Message, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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