trojan

package
v0.0.0-...-6cad18a Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: GPL-3.0 Imports: 20 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, overlay tunnel.Tunnel) (tunnel.Conn, error)

func (*Client) DialPacket

func (c *Client) DialPacket(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"`
}

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) Metadata

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

func (*InboundConn) Read

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

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) Metadata

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

func (*OutboundConn) Read

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

func (*OutboundConn) Write

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

func (*OutboundConn) WriteHeader

func (c *OutboundConn) WriteHeader(payload []byte) (bool, 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