Documentation ¶
Overview ¶
Package network holds the typed objects that define the schemas for configuring the knative networking layer.
Index ¶
- Constants
- Variables
- func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error)
- func GetClusterDomainName() string
- func GetServiceHostname(name string, namespace string) string
- func NewAutoTransport() http.RoundTripper
- func NewH2CTransport() http.RoundTripper
- func NewProberTransport() http.RoundTripper
- func NewServer(addr string, h http.Handler) *http.Server
- type RoundTripperFunc
Constants ¶
const ( // DefaultConnTimeout specifies a short default connection timeout // to avoid hitting the issue fixed in // https://github.com/kubernetes/kubernetes/pull/72534 but only // avalailable after Kubernetes 1.14. // // Our connections are usually between pods in the same cluster // like activator <-> queue-proxy, or even between containers // within the same pod queue-proxy <-> user-container, so a // smaller connect timeout would be justifiable. // // We should consider exposing this as a configuration. DefaultConnTimeout = 200 * time.Millisecond // UserAgentKey is the constant for header "User-Agent". UserAgentKey = "User-Agent" // ProbeHeaderName is the name of a header that can be added to // requests to probe the knative networking layer. Requests // with this header will not be passed to the user container or // included in request metrics. ProbeHeaderName = "K-Network-Probe" )
Variables ¶
var AutoTransport = NewAutoTransport()
AutoTransport uses h2c for HTTP2 requests and falls back to `http.DefaultTransport` for all others
Functions ¶
func ErrorHandler ¶
func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error)
ErrorHandler sets up a handler suitable for use with the ErrorHandler field on httputil's reverse proxy.
func GetClusterDomainName ¶
func GetClusterDomainName() string
GetClusterDomainName returns cluster's domain name or an error Closes issue: https://github.com/knative/eventing/issues/714
func GetServiceHostname ¶
GetServiceHostname returns the fully qualified service hostname
func NewAutoTransport ¶
func NewAutoTransport() http.RoundTripper
NewAutoTransport creates a RoundTripper that can use appropriate transport based on the request's HTTP version.
func NewH2CTransport ¶
func NewH2CTransport() http.RoundTripper
NewH2CTransport constructs a new H2C transport. That transport will reroute all HTTPS traffic to HTTP. This is to explicitly allow h2c (http2 without TLS) transport. See https://github.com/golang/go/issues/14141 for more details.
func NewProberTransport ¶
func NewProberTransport() http.RoundTripper
NewProberTransport creates a RoundTripper that is useful for probing, since it will not cache connections.