trojan

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Connect   tunnel.Command = 1
	Associate tunnel.Command = 3
	Mux       tunnel.Command = 0x7f
)
View Source
const (
	MaxPacketSize = 1024 * 8
)
View Source
const Name = "TROJAN"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, client tunnel.Client) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) DialConn

func (c *Client) DialConn(addr *tunnel.Address, user statistic.User, metadata *tunnel.Metadata, overlay tunnel.Tunnel) (tunnel.Conn, error)

func (*Client) DialPacket

func (c *Client) DialPacket(user statistic.User, _ tunnel.Tunnel) (tunnel.PacketConn, error)

type Config

type Config struct {
	LocalHost        string      `json:"local_addr" yaml:"local-addr"`
	LocalPort        int         `json:"local_port" yaml:"local-port"`
	RemoteHost       string      `json:"remote_addr" yaml:"remote-addr"`
	RemotePort       int         `json:"remote_port" yaml:"remote-port"`
	DisableHTTPCheck bool        `json:"disable_http_check" yaml:"disable-http-check"`
	MySQL            MySQLConfig `json:"mysql" yaml:"mysql"`
	API              APIConfig   `json:"api" yaml:"api"`
	UserPassThrough  bool        `json:"user_pass_through yaml:"user-pass-through"`
}

type InboundConn

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

InboundConn is a trojan inbound connection

func (*InboundConn) Auth

func (c *InboundConn) Auth() error

func (*InboundConn) Close

func (c *InboundConn) Close() error

func (*InboundConn) Epoch

func (c *InboundConn) Epoch() time.Time

func (*InboundConn) Metadata

func (c *InboundConn) Metadata() *tunnel.Metadata

func (*InboundConn) Name

func (c *InboundConn) Name() string

func (*InboundConn) Read

func (c *InboundConn) Read(p []byte) (int, error)

func (*InboundConn) Recv

func (c *InboundConn) Recv() uint64

func (*InboundConn) Sent

func (c *InboundConn) Sent() uint64

func (*InboundConn) Tunnels

func (c *InboundConn) Tunnels() *tunnel.Tunnels

func (*InboundConn) User

func (c *InboundConn) User() statistic.User

func (*InboundConn) Write

func (c *InboundConn) Write(p []byte) (int, error)

type MySQLConfig

type MySQLConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

type OutboundConn

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

func (*OutboundConn) Close

func (c *OutboundConn) Close() error

func (*OutboundConn) Epoch

func (c *OutboundConn) Epoch() time.Time

func (*OutboundConn) Metadata

func (c *OutboundConn) Metadata() *tunnel.Metadata

func (*OutboundConn) Name

func (c *OutboundConn) Name() string

func (*OutboundConn) Read

func (c *OutboundConn) Read(p []byte) (int, error)

func (*OutboundConn) Recv

func (c *OutboundConn) Recv() uint64

func (*OutboundConn) Sent

func (c *OutboundConn) Sent() uint64

func (*OutboundConn) Tunnels

func (c *OutboundConn) Tunnels() *tunnel.Tunnels

func (*OutboundConn) User

func (c *OutboundConn) User() statistic.User

func (*OutboundConn) Write

func (c *OutboundConn) Write(p []byte) (int, error)

func (*OutboundConn) WriteHeader

func (c *OutboundConn) WriteHeader(payload []byte) error

type PacketConn

type PacketConn struct {
	tunnel.Conn
}

func (*PacketConn) ReadFrom

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

func (*PacketConn) ReadWithMetadata

func (c *PacketConn) ReadWithMetadata(payload []byte) (int, *tunnel.Metadata, error)

func (*PacketConn) WriteTo

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

func (*PacketConn) WriteWithMetadata

func (c *PacketConn) WriteWithMetadata(payload []byte, metadata *tunnel.Metadata) (int, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a trojan tunnel server

func NewServer

func NewServer(ctx context.Context, underlay tunnel.Server) (*Server, error)

func (*Server) AcceptConn

func (s *Server) AcceptConn(nextTunnel tunnel.Tunnel) (tunnel.Conn, error)

func (*Server) AcceptPacket

func (s *Server) AcceptPacket(tunnel.Tunnel) (tunnel.PacketConn, error)

func (*Server) Close

func (s *Server) Close() error

type Tunnel

type Tunnel struct{}

func (*Tunnel) Name

func (c *Tunnel) Name() string

func (*Tunnel) NewClient

func (c *Tunnel) NewClient(ctx context.Context, client tunnel.Client) (tunnel.Client, error)

func (*Tunnel) NewServer

func (c *Tunnel) NewServer(ctx context.Context, server tunnel.Server) (tunnel.Server, error)

Jump to

Keyboard shortcuts

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