proxy

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDiaTimeout      = 1 * time.Second
	DefaultWSHeartInterval = 30 * time.Second
)

time duration consts.

View Source
const (
	SchemeHTTP         = "http"
	SchemeHTTPS        = "https"
	SchemeWebsocket    = "ws"
	SchemeWebsocketSec = "wss"
)

Schemes

Variables

This section is empty.

Functions

func FromURLBy

func FromURLBy(u *url.URL, forward proxy.Dialer) (proxy.Dialer, error)

FromURLBy returns a proxy.Dialer given a URL specification and an underlying proxy.Dialer for it to make network requests. FromURL may be passed to proxy.RegisterDialerType for the schemes "http" and "https". The convenience function RegisterDialerFromURL simplifies this.

func FromURLWithConfig

func FromURLWithConfig(u *url.URL, forward proxy.Dialer, cfg *Config) (proxy.Dialer, error)

FromURLWithConfig is like New, but allows control over various options.

func GeneratorWithConfig

func GeneratorWithConfig(cfg *Config) base.SchemeDialerGenerator

GeneratorWithConfig is like ConnectFromURLWithConfig, but is suitable for passing to proxy.RegisterDialerType while maintaining configuration options.

This is to enable registration of an http(s) proxy with options, e.g.:

proxy.RegisterDialerType("https", myproxy.GeneratorWithConfig(
        &myproxy.Config{DialTimeout: 5 * time.Minute},
))

func RegisterProxyDialer

func RegisterProxyDialer(proxyConfig *Config)

RegisterProxyDialer register proxy dialer for http/https/ws/wss schemes.

Types

type BaseConfig

type BaseConfig struct {
	TLSClientConfig *tls.Config   // tls client config for https|wss
	Header          http.Header   // http addon header
	DialTimeout     time.Duration // proxy dial timeout
}

BaseConfig for proxy.

type Config

type Config struct {
	Base            BaseConfig
	WSHeartInterval time.Duration // websocket part: interval for websocket send ping package to keep alive.

	HTTPMethod string // http part: which method to use for dialing, default: CONNECT.
}

Config for proxy.

func DefaultConfig

func DefaultConfig(u *url.URL) *Config

DefaultConfig return default config for common using, tls will skip tls verify.

Directories

Path Synopsis
Package connect implement proxy.Dialer(s) with http connect method.
Package connect implement proxy.Dialer(s) with http connect method.
Package post implement proxy.Dialer(s) with http post method.
Package post implement proxy.Dialer(s) with http post method.

Jump to

Keyboard shortcuts

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