trojan

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 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 {
	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