trojan

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: GPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func ReadPacket

func ReadPacket(r io.Reader, payload []byte) (net.Addr, int, int, error)

func WritePacket

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

Types

type Command

type Command = byte

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) StreamWebsocketConn added in v1.8.0

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 added in v1.8.0

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