ttproxy

package module
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

README

ttproxy -- The Linux TProxy Client

A simple command line tool which supports HTTP CONNECT method and UDP in HTTP RFC9298.

Usage of ttproxy:
  -httpproxy string
    	enable http proxy host:port
  -password string
    	proxy server password (default "test1234")
  -pprof
    	enable net/http/pprof
  -server string
    	proxy server address: host:port (default "test.cc:443") or chained "socks5://192.168.1.1:1080;test.cc:443"
  -timeout duration
    	timeout duration for UDP connection (default 3m0s)
  -tls
    	use tls to connect proxy server
  -tproxy string
    	tproxy listen address: host:port (default "127.0.0.1:7789")
  -user string
    	proxy server user name (default "test")

Server

The suggested server is caddy with module customzied forwardproxy.

Documentation

Index

Constants

View Source
const (
	RequestProtocol = "connect-udp"

	CapsuleProtocolHeader    = "Capsule-Protocol"
	ConnectUDPBindHeader     = "Connect-Udp-Bind"
	ProxyAuthorizationHeader = "Proxy-Authorization"
	ProxyPublicAddressHeader = "Proxy-Public-Address"

	CapsuleProtocolHeaderValue = "?1"
	ConnectUDPBindHeaderValue  = "?1"

	CompressionAssignValue = 0x1C0FE323
	CompressionCloseValue  = 0x1C0FE324
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Auth       proxy.Auth
	HostPort   string
	TProxyAddr string
	Timeout    time.Duration
	EnableTLS  bool
	PProf      bool
	HTTPAddr   string
}

type PacketConn

type PacketConn struct {
	datagram.DatagramSender
	Conn       net.Conn
	ContextID  uint64
	ContextMap sync.Map
	AddrMap    sync.Map
	// contains filtered or unexported fields
}

func (*PacketConn) Add

func (nm *PacketConn) Add(id uint64, addr netip.AddrPort)

func (*PacketConn) Close added in v0.3.0

func (nm *PacketConn) Close() error

func (*PacketConn) Del

func (nm *PacketConn) Del(id uint64)

func (*PacketConn) Firewall added in v0.3.0

func (nm *PacketConn) Firewall() bool

func (*PacketConn) GetAddr

func (nm *PacketConn) GetAddr(id uint64) (netip.AddrPort, bool)

func (*PacketConn) GetContextID

func (nm *PacketConn) GetContextID(addr netip.AddrPort) (uint64, bool)

func (*PacketConn) ReadPacket added in v0.3.0

func (pc *PacketConn) ReadPacket(buf []byte) ([]byte, uint64, error)

func (*PacketConn) SetFirewall added in v0.3.0

func (nm *PacketConn) SetFirewall(ok bool) error

func (*PacketConn) SetReadDeadline added in v0.3.0

func (pc *PacketConn) SetReadDeadline(time time.Time) error

func (*PacketConn) WriteToUDPAddrPort

func (pc *PacketConn) WriteToUDPAddrPort(b []byte, raddr netip.AddrPort) (int, error)

type Server

type Server struct {
	Config
	Dialer proxy.Dialer

	Host      string
	Port      string
	BasicAuth string
	// contains filtered or unexported fields
}

func (Server) Dial

func (srv Server) Dial(network, addr string) (net.Conn, error)

a HTTP dialer which utilizes HTTP CONNECT method for TCP and RFC 9298 for UDP

func (*Server) Serve

func (srv *Server) Serve(cfg Config) error

func (*Server) ServeHTTP added in v0.5.0

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (Server) ServeTProxyTCP

func (srv Server) ServeTProxyTCP() error

func (Server) ServeTProxyUDP

func (srv Server) ServeTProxyUDP() error

Directories

Path Synopsis
cmd
ttproxy command
pkg

Jump to

Keyboard shortcuts

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