trojan

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandTCP byte = 1
	CommandUDP byte = 3
)

Variables

This section is empty.

Functions

func ReadPacket

func ReadPacket(r io.Reader, payload []byte) (addr *net.UDPAddr, n int, remain int, err error)

func WritePacket

func WritePacket(w io.Writer, socks5Addr, payload []byte) (n int, err error)

Types

type Command

type Command = byte

type HTTPOptions

type HTTPOptions struct {
	Host    string
	Port    int
	Hosts   []string
	Path    string
	Headers http.Header
}

type Option

type Option struct {
	Password       string
	ALPN           []string
	ServerName     string
	SkipCertVerify bool
}

type PacketConn

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

func (*PacketConn) ReadFrom

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

func (*PacketConn) WriteTo

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

type Trojan

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

func New

func New(option *Option) *Trojan

func (*Trojan) PacketConn

func (t *Trojan) PacketConn(conn net.Conn) net.PacketConn

func (*Trojan) StreamConn

func (t *Trojan) StreamConn(conn net.Conn) (net.Conn, error)

func (*Trojan) StreamH2Conn

func (t *Trojan) StreamH2Conn(conn net.Conn, h2Option *HTTPOptions) (net.Conn, error)

func (*Trojan) StreamWebsocketConn

func (t *Trojan) StreamWebsocketConn(conn net.Conn, wsOptions *WebsocketOption) (net.Conn, error)

func (*Trojan) WriteHeader

func (t *Trojan) WriteHeader(w io.Writer, command Command, socks5Addr []byte) error

type WebsocketOption

type WebsocketOption struct {
	Host    string
	Port    string
	Path    string
	Headers http.Header
}

Jump to

Keyboard shortcuts

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