trojanc

package
v0.0.0-...-5f1f6bc Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CRLF        = []byte{13, 10}
	FailAuthErr = fmt.Errorf("incorrect password")
)
View Source
var (
	ErrInvalidMetadata = fmt.Errorf("invalid metadata")
)

Functions

func MetadataTypeToByte

func MetadataTypeToByte(typ protocol.MetadataType) byte

func NetworkToByte

func NetworkToByte(network string) byte

func NewDialer

func NewDialer(nextDialer netproxy.Dialer, header protocol.Header) (netproxy.Dialer, error)

func ParseMetadataType

func ParseMetadataType(t byte) protocol.MetadataType

func ParseNetwork

func ParseNetwork(n byte) string

func SealUDP

func SealUDP(metadata Metadata, dst []byte, data []byte) []byte

Types

type Conn

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

func NewConn

func NewConn(conn netproxy.Conn, metadata Metadata, password string) (c *Conn, err error)

func (*Conn) Read

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

func (*Conn) ReadReqHeader

func (c *Conn) ReadReqHeader() (err error)

func (*Conn) Write

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

type Dialer

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

func (*Dialer) Dial

func (d *Dialer) Dial(network string, addr string) (c netproxy.Conn, err error)

func (*Dialer) DialTcp

func (d *Dialer) DialTcp(addr string) (c netproxy.Conn, err error)

func (*Dialer) DialUdp

func (d *Dialer) DialUdp(addr string) (c netproxy.PacketConn, err error)

type Metadata

type Metadata struct {
	protocol.Metadata
	Network string
}

func (*Metadata) Len

func (m *Metadata) Len() int

func (*Metadata) PackTo

func (m *Metadata) PackTo(dst []byte) (n int)

func (*Metadata) Unpack

func (m *Metadata) Unpack(r io.Reader) (n int, err error)

type PacketConn

type PacketConn struct {
	*Conn
}

func (*PacketConn) Read

func (c *PacketConn) Read(b []byte) (n int, err error)

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(p []byte) (n int, addr netip.AddrPort, err error)

func (*PacketConn) Write

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

func (*PacketConn) WriteTo

func (c *PacketConn) WriteTo(p []byte, addr string) (n int, err error)

Jump to

Keyboard shortcuts

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