proxy

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const StreamTypeProxy = 0x01

Stream type marker (first byte sent on yamux stream)

View Source
const (
	StreamTypeUDP = 0x03
)

Stream type markers for Yamux multiplexing

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPProxyServer

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

HTTPProxyServer implements a standard HTTP/HTTPS forward proxy

func NewHTTPProxyServer

func NewHTTPProxyServer(bindAddr string, session *yamux.Session, router *routing.Router) (*HTTPProxyServer, error)

NewHTTPProxyServer creates a local HTTP proxy server

func (*HTTPProxyServer) Addr

func (s *HTTPProxyServer) Addr() net.Addr

Addr returns the proxy listen address

func (*HTTPProxyServer) Close

func (s *HTTPProxyServer) Close() error

Close stops the HTTP server

func (*HTTPProxyServer) GetStats

func (s *HTTPProxyServer) GetStats() *Stats

GetStats returns the current stats reference

func (*HTTPProxyServer) Serve

func (s *HTTPProxyServer) Serve()

Serve starts accepting HTTP connections

type SOCKS5Server

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

SOCKS5Server is a minimal local SOCKS5 proxy that tunnels through yamux

func NewSOCKS5Server

func NewSOCKS5Server(bindAddr string, session *yamux.Session, router *routing.Router) (*SOCKS5Server, error)

NewSOCKS5Server creates a new SOCKS5 proxy server

func (*SOCKS5Server) Addr

func (s *SOCKS5Server) Addr() net.Addr

Addr returns the proxy listen address

func (*SOCKS5Server) Close

func (s *SOCKS5Server) Close() error

Close stops the SOCKS5 server

func (*SOCKS5Server) GetStats

func (s *SOCKS5Server) GetStats() *Stats

GetStats returns the current stats reference

func (*SOCKS5Server) Serve

func (s *SOCKS5Server) Serve()

Serve starts accepting SOCKS5 connections (blocking)

type Stats

type Stats struct {
	BytesUp     atomic.Int64
	BytesDown   atomic.Int64
	ActiveConns atomic.Int32
	TotalConns  atomic.Int64
	ConnectedAt time.Time
}

Stats tracks proxy traffic statistics

Jump to

Keyboard shortcuts

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