packet

package
v0.0.0-...-ff36db3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeTypes_Api     NodeTypes = "api"
	NodeTypes_Storage           = "stprage"
	NodeTypes_Master            = "master"
)
View Source
const HASH_LEN = 32
View Source
const HEADER_LEN = 4
View Source
const PROROCOL_LEN = 4

Variables

This section is empty.

Functions

func Auth

func Auth()

Auth 建立授权.

func New

func New(content, fileHash []byte, num protocol.GossProtocol) []byte

func NewNode

func NewNode(types NodeTypes, ip string, proto protocol.GossProtocol) []byte

NewNode.

Types

type NodePacket

type NodePacket struct {
	Protocol protocol.GossProtocol //协议号.
	Types    NodeTypes             //节点类型.
	IP       string                //节点ip.
	Size     int64
}

NodePacket 节点管理数据.

func ParseNode

func ParseNode(conn net.Conn) (pkt NodePacket, err error)

type NodeTypes

type NodeTypes string

type Packet

type Packet struct {
	Protocol protocol.GossProtocol
	Size     int64
	Hash     string
	Body     []byte
}

func Parse

func Parse(conn net.Conn) (pkt Packet, err error)

Parse 解析网络数据包.

Jump to

Keyboard shortcuts

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