// JoinPreservingTrailingSlash does a path.Join of the specified elements, // preserving any trailing slash on the last non-empty segment func JoinPreservingTrailingSlash(elem ...string) string { … } // IsTimeout returns true if the given error is a network timeout error func IsTimeout(err error) bool { … } // IsProbableEOF returns true if the given error resembles a connection termination // scenario that would justify assuming that the watch is empty. // These errors are what the Go http stack returns back to us which are general // connection closure errors (strongly correlated) and callers that need to // differentiate probable errors in connection behavior between normal "this is // disconnected" should use the method. func IsProbableEOF(err error) bool { … } var defaultTransport … // SetOldTransportDefaults applies the defaults from http.DefaultTransport // for the Proxy, Dial, and TLSHandshakeTimeout fields if unset func SetOldTransportDefaults(t *http.Transport) *http.Transport { … } // SetTransportDefaults applies the defaults from http.DefaultTransport // for the Proxy, Dial, and TLSHandshakeTimeout fields if unset func SetTransportDefaults(t *http.Transport) *http.Transport { … } func readIdleTimeoutSeconds() int { … } func pingTimeoutSeconds() int { … } func configureHTTP2Transport(t *http.Transport) error { … } func allowsHTTP2(t *http.Transport) bool { … } type RoundTripperWrapper … type DialFunc … func DialerFor(transport http.RoundTripper) (DialFunc, error) { … } // CloseIdleConnectionsFor close idles connections for the Transport. // If the Transport is wrapped it iterates over the wrapped round trippers // until it finds one that implements the CloseIdleConnections method. // If the Transport does not have a CloseIdleConnections method // then this function does nothing. func CloseIdleConnectionsFor(transport http.RoundTripper) { … } type TLSClientConfigHolder … func TLSClientConfig(transport http.RoundTripper) (*tls.Config, error) { … } func FormatURL(scheme string, host string, port int, path string) *url.URL { … } func GetHTTPClient(req *http.Request) string { … } // SourceIPs splits the comma separated X-Forwarded-For header and joins it with // the X-Real-Ip header and/or req.RemoteAddr, ignoring invalid IPs. // The X-Real-Ip is omitted if it's already present in the X-Forwarded-For chain. // The req.RemoteAddr is always the last IP in the returned list. // It returns nil if all of these are empty or invalid. func SourceIPs(req *http.Request) []net.IP { … } // Checks whether the given IP address is contained in the list of IPs. func containsIP(ips []net.IP, ip net.IP) bool { … } // Extracts and returns the clients IP from the given request. // Looks at X-Forwarded-For header, X-Real-Ip header and request.RemoteAddr in that order. // Returns nil if none of them are set or is set to an invalid value. func GetClientIP(req *http.Request) net.IP { … } // Prepares the X-Forwarded-For header for another forwarding hop by appending the previous sender's // IP address to the X-Forwarded-For chain. func AppendForwardedForHeader(req *http.Request) { … } var defaultProxyFuncPointer … // isDefault checks to see if the transportProxierFunc is pointing to the default one func isDefault(transportProxier func(*http.Request) (*url.URL, error)) bool { … } // NewProxierWithNoProxyCIDR constructs a Proxier function that respects CIDRs in NO_PROXY and delegates if // no matching CIDRs are found func NewProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error)) func(req *http.Request) (*url.URL, error) { … } type DialerFunc … func (fn DialerFunc) Dial(req *http.Request) (net.Conn, error) { … } type Dialer … // CloneRequest creates a shallow copy of the request along with a deep copy of the Headers. func CloneRequest(req *http.Request) *http.Request { … } // CloneHeader creates a deep copy of an http.Header. func CloneHeader(in http.Header) http.Header { … } type WarningHeader … // ParseWarningHeaders extract RFC2616 14.46 warnings headers from the specified set of header values. // Multiple comma-separated warnings per header are supported. // If errors are encountered on a header, the remainder of that header are skipped and subsequent headers are parsed. // Returns successfully parsed warnings and any errors encountered. func ParseWarningHeaders(headers []string) ([]WarningHeader, []error) { … } var codeMatcher … var wordDecoder … // ParseWarningHeader extracts one RFC2616 14.46 warning from the specified header, // returning an error if the header does not contain a correctly formatted warning. // Any remaining content in the header is returned. func ParseWarningHeader(header string) (result WarningHeader, remainder string, err error) { … } func parseQuotedString(quotedString string) (string, string, error) { … } func NewWarningHeader(code int, agent, text string) (string, error) { … } func hasAnyRunes(s string, runeCheckers ...func(rune) bool) bool { … } func makeQuotedString(s string) string { … }