1 package sockets 2 3 import ( 4 "net" 5 "os" 6 "strings" 7 ) 8 9 // GetProxyEnv allows access to the uppercase and the lowercase forms of 10 // proxy-related variables. See the Go specification for details on these 11 // variables. https://golang.org/pkg/net/http/ 12 func GetProxyEnv(key string) string { 13 proxyValue := os.Getenv(strings.ToUpper(key)) 14 if proxyValue == "" { 15 return os.Getenv(strings.ToLower(key)) 16 } 17 return proxyValue 18 } 19 20 // DialerFromEnvironment was previously used to configure a net.Dialer to route 21 // connections through a SOCKS proxy. 22 // DEPRECATED: SOCKS proxies are now supported by configuring only 23 // http.Transport.Proxy, and no longer require changing http.Transport.Dial. 24 // Therefore, only sockets.ConfigureTransport() needs to be called, and any 25 // sockets.DialerFromEnvironment() calls can be dropped. 26 func DialerFromEnvironment(direct *net.Dialer) (*net.Dialer, error) { 27 return direct, nil 28 } 29