Documentation
¶
Index ¶
- Constants
- Variables
- func GenToken(state quic.ConnectionState, uuid [16]byte, password string) (token [32]byte, err error)
- func NewDialer(nextDialer netproxy.Dialer, header protocol.Header) (netproxy.Dialer, error)
- type Address
- type Authenticate
- type BufferedReader
- type BufferedWriter
- type ClientOption
- type CommandHead
- type CommandType
- type Connect
- type Dialer
- type Dissociate
- type Heartbeat
- type Packet
- type Packets
Constants ¶
View Source
const ( AuthenticateType = CommandType(0x00) ConnectType = CommandType(0x01) PacketType = CommandType(0x02) DissociateType = CommandType(0x03) HeartbeatType = CommandType(0x04) )
View Source
const ( AtypDomainName byte = 0 AtypIPv4 byte = 1 AtypIPv6 byte = 2 AtypNone byte = 255 // Address type None is used in Packet commands that is not the first fragment of a UDP packet. )
Addr types
View Source
const ( ProtocolError = quic.ApplicationErrorCode(0xfffffff0) AuthenticationFailed = quic.ApplicationErrorCode(0xfffffff1) AuthenticationTimeout = quic.ApplicationErrorCode(0xfffffff2) BadCommand = quic.ApplicationErrorCode(0xfffffff3) )
View Source
const ( DefaultTCPTimeout = 5 * time.Second DefaultUDPTimeout = DefaultTCPTimeout )
View Source
const Ver5 = 0x5
Variables ¶
View Source
var PacketOverHead = NewPacket(0, 0, 0, 0, 0, NewAddressAddrPort(netip.AddrPortFrom(netip.IPv6Unspecified(), 0)), nil, 0).BytesLen()
Functions ¶
Types ¶
type Address ¶
func NewAddress ¶
func NewAddressAddrPort ¶
func ReadAddress ¶
func ReadAddress(reader BufferedReader) (c *Address, err error)
func (Address) WriteTo ¶
func (c Address) WriteTo(writer BufferedWriter) (err error)
func (Address) WriteToBytes ¶
type Authenticate ¶
type Authenticate struct {
*CommandHead
UUID uuid.UUID
TOKEN [32]byte
VER byte
}
func NewAuthenticate ¶
func NewAuthenticate(UUID [16]byte, TOKEN [32]byte, VER byte) *Authenticate
func ReadAuthenticate ¶
func ReadAuthenticate(reader BufferedReader) (c *Authenticate, err error)
func ReadAuthenticateWithHead ¶
func ReadAuthenticateWithHead(head *CommandHead, reader BufferedReader) (c *Authenticate, err error)
func (Authenticate) BytesLen ¶
func (c Authenticate) BytesLen() int
func (Authenticate) WriteTo ¶
func (c Authenticate) WriteTo(writer BufferedWriter) (err error)
type BufferedReader ¶
type BufferedReader interface {
io.Reader
io.ByteReader
}
type BufferedWriter ¶
type BufferedWriter interface {
io.Writer
io.ByteWriter
}
type ClientOption ¶
type CommandHead ¶
type CommandHead struct {
VER byte
TYPE CommandType
}
func NewCommandHead ¶
func NewCommandHead(TYPE CommandType, VER byte) *CommandHead
func ReadCommandHead ¶
func ReadCommandHead(reader BufferedReader) (c *CommandHead, err error)
func (CommandHead) BytesLen ¶
func (c CommandHead) BytesLen() int
func (CommandHead) WriteTo ¶
func (c CommandHead) WriteTo(writer BufferedWriter) (err error)
func (CommandHead) WriteToBytes ¶
func (c CommandHead) WriteToBytes(buf []byte) (n int)
type CommandType ¶
type CommandType byte
func (CommandType) BytesLen ¶
func (c CommandType) BytesLen() int
func (CommandType) String ¶
func (c CommandType) String() string
type Connect ¶
type Connect struct {
*CommandHead
ADDR *Address
}
func NewConnect ¶
func ReadConnect ¶
func ReadConnect(reader BufferedReader) (c *Connect, err error)
func ReadConnectWithHead ¶
func ReadConnectWithHead(head *CommandHead, reader BufferedReader) (c *Connect, err error)
func (Connect) WriteTo ¶
func (c Connect) WriteTo(writer BufferedWriter) (err error)
func (Connect) WriteToBytes ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
func (*Dialer) DialContext ¶
type Dissociate ¶
type Dissociate struct {
*CommandHead
ASSOC_ID uint16
}
func NewDissociate ¶
func NewDissociate(ASSOC_ID uint16, VER byte) *Dissociate
func ReadDissociate ¶
func ReadDissociate(reader BufferedReader) (c *Dissociate, err error)
func ReadDissociateWithHead ¶
func ReadDissociateWithHead(head *CommandHead, reader BufferedReader) (c *Dissociate, err error)
func (Dissociate) BytesLen ¶
func (c Dissociate) BytesLen() int
func (Dissociate) WriteTo ¶
func (c Dissociate) WriteTo(writer BufferedWriter) (err error)
type Heartbeat ¶
type Heartbeat struct {
*CommandHead
}
func NewHeartbeat ¶
func ReadHeartbeat ¶
func ReadHeartbeat(reader BufferedReader) (c *Heartbeat, err error)
func ReadHeartbeatWithHead ¶
func ReadHeartbeatWithHead(head *CommandHead, reader BufferedReader) (c *Heartbeat, err error)
type Packet ¶
type Packet struct {
*CommandHead
ASSOC_ID uint16
PKT_ID uint16
FRAG_TOTAL uint8
FRAG_ID uint8
SIZE uint16
ADDR *Address
DATA []byte
}
func ReadPacket ¶
func ReadPacket(reader BufferedReader) (c *Packet, err error)
func ReadPacketWithHead ¶
func ReadPacketWithHead(head *CommandHead, reader BufferedReader) (c *Packet, err error)
func (Packet) WriteTo ¶
func (c Packet) WriteTo(writer BufferedWriter) (err error)
type Packets ¶
type Packets struct {
// contains filtered or unexported fields
}
func NewPackets ¶
func NewPackets() *Packets
func (*Packets) PopFrontBlock ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.