trojan

package
v0.3.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 11 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 {
	// 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(addr proxy.Address) (net.Conn, error)

func (*Client) PacketConn

func (c *Client) PacketConn(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