chained

package
v7.6.100 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: GPL-3.0 Imports: 80 Imported by: 1

Documentation

Overview

Package chained provides a chained proxy that can proxy any tcp traffic over any underlying transport through a remote proxy. The downstream (client) side of the chained setup is just a dial function. The upstream (server) side is just an http.Handler. The client tells the server where to connect using an HTTP CONNECT request.

Index

Constants

This section is empty.

Variables

View Source
var (
	// IdleTimeout closes connections idle for a period to avoid dangling
	// connections. Web applications tend to contact servers in 1 minute
	// interval or below. 65 seconds is long enough to avoid interrupt normal
	// connections but shorter than the idle timeout on the server to avoid
	// running into closed connection problems.
	IdleTimeout = 65 * time.Second
)
View Source
var InsecureSkipVerifyTLSMasqOrigin = false

InsecureSkipVerifyTLSMasqOrigin controls whether the origin certificate is verified when dialing a tlsmasq proxy. This can be used when testing against origins with self-signed certificates. This should be false in production as allowing a 3rd party to impersonate the origin could allow for a kind of probe.

Functions

func ActivelyObtainBrowserHello added in v7.6.46

func ActivelyObtainBrowserHello(ctx context.Context, configDir string) (*helloSpec, error)

ActivelyObtainBrowserHello obtains a sample TLS ClientHello via listening for local traffic.

func CopyConfig

func CopyConfig(pc *config.ProxyConfig) *config.ProxyConfig

CopyConfig makes a safe copy of the config to avoid any data corruption for other users of the config.

func CopyConfigs

func CopyConfigs(proxies map[string]*config.ProxyConfig) map[string]*config.ProxyConfig

CopyConfigs makes a safe copy of the config to avoid any data corruption for other users of the config.

func CreateDialer

func CreateDialer(configDir, name string, s *config.ProxyConfig, uc common.UserConfig) (bandit.Dialer, error)

CreateDialer creates a Proxy (balancer.Dialer) with supplied server info.

func CreateDialers

func CreateDialers(configDir string, proxies map[string]*config.ProxyConfig, uc common.UserConfig) []bandit.Dialer

CreateDialers creates a list of Proxies (bandit.Dialer) with supplied server info.

func CreateDialersMap

func CreateDialersMap(configDir string, proxies map[string]*config.ProxyConfig, uc common.UserConfig) map[string]bandit.Dialer

CreateDialersMap creates a map of Proxies (bandit.Dialer) with supplied server info.

func CreateMPDialer

func CreateMPDialer(configDir, endpoint string, ss map[string]*config.ProxyConfig, uc common.UserConfig) (bandit.Dialer, error)

func ForceProxy

func ForceProxy(forceAddr string, forceToken string)

ForceProxy forces everything through the HTTP proxy at forceAddr using forceToken.

func PersistSessionStates

func PersistSessionStates(configDir string)

PersistSessionStates makes sure that session states are stored on disk in the given configDir

func TrackStatsFor

func TrackStatsFor(dialers []bandit.Dialer, configDir string)

TrackStatsFor enables periodic checkpointing of the given proxies' stats to disk.

Types

type KCPConfig

type KCPConfig struct {
	kcpwrapper.DialerConfig `mapstructure:",squash"`
	RemoteAddr              string `json:"remoteaddr"`
}

KCPConfig adapts kcpwrapper.DialerConfig to the currently deployed configurations in order to provide backward-compatibility.

type PrefixSaltGen added in v7.6.86

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

func (*PrefixSaltGen) GetSalt added in v7.6.86

func (p *PrefixSaltGen) GetSalt(salt []byte) error

type Server

type Server struct {
	// Dial: function for dialing destination
	Dial func(network, address string) (net.Conn, error)
}

Server provides the upstream side of a chained proxy setup. It can be run as a standalone HTTP server using Serve() or plugged into an existing HTTP server as an http.Handler.

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

Serve provides a convenience function for starting an HTTP server using this Server as the Handler.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(resp http.ResponseWriter, req *http.Request)

ServeHTTP implements the method from http.Handler.

Directories

Path Synopsis
Package prefixgen defines a language for generating connection prefixes.
Package prefixgen defines a language for generating connection prefixes.

Jump to

Keyboard shortcuts

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