proxy

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: LGPL-3.0 Imports: 4 Imported by: 55

README

proxy

A type for grouping information about proxy variables.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Settings

type Settings struct {
	Http        string
	Https       string
	Ftp         string
	NoProxy     string
	AutoNoProxy string
}

Settings holds the values for the HTTP, HTTPS and FTP proxies as well as the no_proxy value found by Detect Proxies. AutoNoProxy is filled with addresses of controllers, we never want to proxy those

func DetectProxies

func DetectProxies() Settings

DetectProxies returns the proxy settings found the environment.

func (*Settings) AsEnvironmentValues

func (s *Settings) AsEnvironmentValues() []string

AsEnvironmentValues returns a slice of strings of the format "key=value" suitable to be used in a command environment. There are two values for each non-empty proxy value, one lower-case and one upper-case.

func (*Settings) AsScriptEnvironment

func (s *Settings) AsScriptEnvironment() string

AsScriptEnvironment returns a potentially multi-line string in a format that specifies exported key=value lines. There are two lines for each non- empty proxy value, one lower-case and one upper-case.

func (*Settings) AsSystemdDefaultEnv

func (s *Settings) AsSystemdDefaultEnv() string

AsSystemdEnvSettings returns a string in the format understood by systemd: DefaultEnvironment="http_proxy=...." "HTTP_PROXY=..." ...

func (*Settings) FullNoProxy

func (s *Settings) FullNoProxy() string

FullNoProxy merges NoProxy and AutoNoProxyList

func (*Settings) HasProxySet

func (s *Settings) HasProxySet() bool

HasProxySet returns true if there is a proxy value for HTTP, HTTPS or FTP.

func (*Settings) SetEnvironmentValues

func (s *Settings) SetEnvironmentValues()

SetEnvironmentValues updates the process environment with the proxy values stored in the settings object. Both the lower-case and upper-case variants are set.

http_proxy, HTTP_PROXY https_proxy, HTTPS_PROXY ftp_proxy, FTP_PROXY

Jump to

Keyboard shortcuts

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