Documentation
¶
Overview ¶
Package h2s provides a tool that wraps one or multiple HTTP or HTTPS proxies into a SOCKS5 proxy. It does something like polipo and privoxy do, but in a reversed way.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// HTTP proxy upstreams.
Upstreams []*Upstream `json:"upstreams"`
// With no Accounts, authentication is disabled.
Accounts []*Account `json:"accounts,omitempty"`
// Timeout value when dialing to a upstream. Default "20s".
Timeout string `json:"timeout"`
// The max retries count of dialing to upstreams. Default 3.
Retries *int `json:"retries"`
}
Config is used to configure an h2s Server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a SOCKS5 server that forward all incoming requests via Upstreams by HTTP/1.1 CONNECT.
type TLSConfig ¶
type TLSConfig struct {
// If empty, ServerName is set to the hostname from Address.
// This is useful in some cases, for example a server behind Cloudflare,
// since Cloudflare would simply reject CONNECT method.
ServerName string `json:"serverName"`
// If you prefer to set a fingerprint instead of providing certs, you can
// set this to true.
//
// Do not set to true unless you know what you are doing.
InsecureSkipVerify bool `json:"insecureSkipVerify"`
// Server's SHA256 fingerprint, used to verify as an alternative to providing
// the whole server certs.
SHA256Fingerprint string `json:"sha256Fingerprint"`
// For self-signed certs. Be careful.
RootCA string `json:"rootCA"`
// For client auth.
CertFile string `json:"certFile"`
KeyFile string `json:"keyFile"`
}
TLSConfig is a simplified version of tls.Config
type Upstream ¶
type Upstream struct {
Address string `json:"address"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
// TLSConfig can be null.
TLSConfig *TLSConfig `json:"tlsConfig"`
}
Upstream is a HTTPS proxy upstream that must support CONNECT method as defined in RFC 7231 section 4.3.6.
Click to show internal directories.
Click to hide internal directories.