trojan

package
v0.3.1-rc.7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPacketSize = 1024 * 8
)

Variables

This section is empty.

Functions

func New

Types

type Client

type Client struct {
	proxy.EmptyDispatch
	// contains filtered or unexported fields
}

modified from https://github.com/p4gefau1t/trojan-go/blob/master/tunnel/trojan/client.go

func (*Client) Conn

func (c *Client) Conn(ctx context.Context, addr proxy.Address) (net.Conn, error)

func (*Client) PacketConn

func (c *Client) PacketConn(ctx context.Context, addr proxy.Address) (net.PacketConn, error)

func (*Client) WriteHeader

func (c *Client) WriteHeader(conn net.Conn, cmd Command, addr proxy.Address) (err error)

type Command

type Command byte
const (
	Connect   Command = 1 // TCP
	Associate Command = 3 // UDP
	Mux       Command = 0x7f
)

type PacketConn

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

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(payload []byte) (n int, _ net.Addr, err error)

func (*PacketConn) WriteTo

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

Jump to

Keyboard shortcuts

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