mubeng

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// HopHeaders are meaningful only for a single transport-level connection, and are not stored by caches or forwarded by proxies.
	HopHeaders = []string{
		"Connection",
		"Keep-Alive",
		"Proxy-Authenticate",
		"Proxy-Authorization",
		"Proxy-Connection",
		"Te",
		"Trailers",
		"Transfer-Encoding",
		"Upgrade",
	}
)

Functions

func Transport

func Transport(p string) (tr *http.Transport, err error)

Transport to auto-switch transport between HTTP/S or SOCKSv5 proxies. Depending on the protocol scheme, returning value of http.Transport with Dialer or Proxy.

Types

type Proxy

type Proxy struct {
	Address   string
	Transport *http.Transport
}

Proxy define the IP address value, http.Transport and other additional options.

func (*Proxy) New

func (proxy *Proxy) New(req *http.Request) (*http.Client, *http.Request)

New define HTTP client & request of http.Request itself.

also removes Hop-by-hop headers when it is sent to backend (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html), then add X-Forwarded-For header value with the IP address value of rotator proxy IP.

Jump to

Keyboard shortcuts

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