packet

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version    uint8 = 1
	DefaultTTL uint8 = 100
)
View Source
const (
	MAC_SIZE          = 6
	IP_SIZE           = 16
	HeaderBuffSize    = 44
	HandshakeBuffSize = 76
	IPBuffSize        = 20
)
View Source
const (
	FvpnPktBuffSize = 2048
)

Variables

This section is empty.

Functions

func DecodeBytes

func DecodeBytes(dst *[]byte, src []byte, idx int) int

func DecodeMacAddr

func DecodeMacAddr(src []byte, idx int) (net.HardwareAddr, int)

func DecodeNetworkId

func DecodeNetworkId(dst string, src []byte, idx int) int

func DecodeUint16

func DecodeUint16(dst *uint16, src []byte, idx int) int

func DecodeUint8

func DecodeUint8(dst *byte, src []byte, idx int) int

func Encode

func Encode(h Header) ([]byte, error)

func EncodeBytes

func EncodeBytes(dst, src []byte, idx int) int

func EncodeUint16

func EncodeUint16(dst []byte, src uint16, idx int) int

func EncodeUint8

func EncodeUint8(dst []byte, src uint8, idx int) int

Types

type Header struct {
	Version uint8  //1
	TTL     uint8  //1
	Flags   uint16 //2
	UserId  [8]byte
	SrcIP   net.IP //16
	DstIP   net.IP //16
}

Header every time sends util frame. 44 byte

func Decode

func Decode(buff []byte) (h Header, err error)

func NewHeader

func NewHeader(msgType uint16, userId string) (Header, error)

type Packet

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

Directories

Path Synopsis
ack

Jump to

Keyboard shortcuts

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