proxy

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = ProxyConfig{}

Functions

This section is empty.

Types

type ProxyConfig

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

ProxyConfig stores the proxy settings that should be used for web requests made from this process.

func (*ProxyConfig) GetProxy

func (pc *ProxyConfig) GetProxy(req *http.Request) (*url.URL, error)

GetProxy returns the URL of the proxy to use for a given request as indicated by the proxy settings. It behaves the same as the net/http.ProxyFromEnvironment function, except that it uses the stored settings rather than pulling the configuration from environment variables. (The implementation is copied from net/http.ProxyFromEnvironment.)

func (*ProxyConfig) InstallInDefaultTransport

func (pc *ProxyConfig) InstallInDefaultTransport() error

InstallInDefaultTransport sets the proxy resolution used by the default HTTP transport to use the proxy details stored in this ProxyConfig. Requests made without an explicit transport will respect these proxy settings.

func (*ProxyConfig) Set

func (pc *ProxyConfig) Set(newSettings proxyutils.Settings) error

Set updates the stored settings to the new ones passed in.

Jump to

Keyboard shortcuts

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