trojan

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: GPL-3.0 Imports: 17 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) (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
	Fingerprint       string
	ClientFingerprint string
	Reality           *tlsC.RealityConfig
}

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) WaitReadFrom

func (pc *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err 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(ctx context.Context, conn net.Conn) (net.Conn, error)

func (*Trojan) StreamWebsocketConn

func (t *Trojan) StreamWebsocketConn(ctx context.Context, 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
	V2rayHttpUpgrade bool
}

Jump to

Keyboard shortcuts

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