protocol

package
v0.0.0-...-d0ac596 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Key      []byte
	Overhead int
	Param    string
}

type Conn

type Conn struct {
	net.Conn
	Protocol
	// contains filtered or unexported fields
}

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type PacketConn

type PacketConn struct {
	N.EnhancePacketConn
	Protocol
}

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*PacketConn) WaitReadFrom

func (c *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err error)

func (*PacketConn) WriteTo

func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error)

type Protocol

type Protocol interface {
	StreamConn(net.Conn, []byte) net.Conn
	PacketConn(N.EnhancePacketConn) N.EnhancePacketConn
	Decode(dst, src *bytes.Buffer) error
	Encode(buf *bytes.Buffer, b []byte) error
	DecodePacket([]byte) ([]byte, error)
	EncodePacket(buf *bytes.Buffer, b []byte) error
}

func PickProtocol

func PickProtocol(name string, b *Base) (Protocol, error)

Jump to

Keyboard shortcuts

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