wire

package
v0.0.0-...-bab7392 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FragmentSize = 1024 * 512

Variables

View Source
var (
	PtypeMap = map[PacketType]string{
		PTypeSendHeader: "SendHeader",
		PtypeSendBody:   "SendBody",
		PtypeEndBody:    "EndBody",
		PtypeReSendBody: "ReSendBody",
	}
)

Functions

func GetRequestId

func GetRequestId() []byte

func WritePacket

func WritePacket(stream network.Stream, packet *Packet) error

Types

type Packet

type Packet struct {
	PType  PacketType
	Offset int32 // current offset
	Total  int32 // total body size
	Data   []byte
}

func ReadPacket

func ReadPacket(stream network.Stream) (*Packet, error)

func (*Packet) String

func (p *Packet) String() string

type PacketType

type PacketType = uint8
const (
	PTypeSendHeader PacketType = iota
	PtypeSendBody   PacketType = iota
	PtypeEndBody    PacketType = iota
	PtypeReSendBody PacketType = iota
)

Jump to

Keyboard shortcuts

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