trojan

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPacketSize = 1024 * 8
)

Variables

This section is empty.

Functions

func NewClient added in v0.3.3

func NewClient(config *protocol.Protocol_Trojan) point.WrapProxy

Types

type Client

type Client struct {
	netapi.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 netapi.Address) (net.Conn, error)

func (*Client) PacketConn

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

func (*Client) WriteHeader

func (c *Client) WriteHeader(conn net.Conn, cmd Command, addr netapi.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