Documentation ¶
Overview ¶
Package proxier provides a implementation of an HTTP client and proxy server using the net/http package.
Index ¶
- func NewUTLSRoundTripper(opts ...UTLSOption) (http.RoundTripper, error)
- func ProxyHTTP(network, addr string, auth *proxy.Auth, forward proxy.Dialer) (*httpProxy, error)
- func ProxyHTTPS(network, addr string, auth *proxy.Auth, forward proxy.Dialer, cfg *utls.Config, ...) (*httpProxy, error)
- type Client
- type Server
- type UTLS
- type UTLSDialer
- type UTLSOption
- type UTLSRoundTripper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUTLSRoundTripper ¶
func NewUTLSRoundTripper(opts ...UTLSOption) (http.RoundTripper, error)
NewUTLSRoundTripper creates a new round tripper that can be used in an HTTP client to handle secure connections using the UTLS protocol.
It takes an optional list of `UTLSOption` arguments that can be used to customize the behavior of the round tripper. It returns an `http.RoundTripper` and an error.
Types ¶
type Client ¶
The Client struct wraps an http.Client and provides a higher-level interface for making HTTP requests. It can be used to customize the behavior of the client, such as specify timeouts.
type UTLS ¶
type UTLS struct {
// contains filtered or unexported fields
}
UTLS represents a uTLS struct.
func UTLSOptions ¶
func UTLSOptions(options ...UTLSOption) UTLS
Options takes one or more UTLSOptions and returns a UTLS struct has been configured according to those options.
type UTLSDialer ¶
type UTLSDialer struct {
// contains filtered or unexported fields
}
type UTLSOption ¶
type UTLSOption func(*UTLS)
UTLSOption is a function type that modifies a UTLS struct by setting one of its fields.
func ClientHello ¶
func ClientHello(ch *utls.ClientHelloID) UTLSOption
ClientHello sets the clientHello field of a UTLS struct to the given clientHello.
func Config ¶
func Config(c *utls.Config) UTLSOption
Config sets the utls config field of a UTLS struct to the given config.
func Proxy ¶
func Proxy(p interface{}) UTLSOption
Proxy sets the proxy field of a UTLS struct to the given proxy.
type UTLSRoundTripper ¶
type UTLSRoundTripper struct {
// contains filtered or unexported fields
}
A http.RoundTripper that uses uTLS (with a specified Client Hello ID) to make TLS connections.
Can only be reused among servers which negotiate the same ALPN.
func (*UTLSRoundTripper) Dialer ¶
func (u *UTLSRoundTripper) Dialer() proxy.Dialer
Dialer returns the underlying *net.Dialer used by the UTLSRoundTripper's proxyDialer. This method is useful for accessing additional properties of the dialer, such as its proxy settings.
func main() { dialer := UTLSRoundTripper.Dialer() conn, err := dialer.Dial("tcp", "example.com:443") if err != nil { panic(err) } // Optional to wraps conn to a tls client for tls transport. conn = tls.Client(conn, &tls.Config{ServerName: "example.com"}) // ... }