network

package
v0.0.0-...-381424b Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package network holds the typed objects that define the schemas for configuring the knative networking layer.

Index

Constants

View Source
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

View Source
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

func GetServiceHostname(name string, namespace string) string

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.

func NewServer

func NewServer(addr string, h http.Handler) *http.Server

NewServer returns a new HTTP Server with HTTP2 handler.

Types

type RoundTripperFunc

type RoundTripperFunc func(*http.Request) (*http.Response, error)

RoundTripperFunc implementation roundtrips a request.

func (RoundTripperFunc) RoundTrip

func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

Directories

Path Synopsis
Package prober contains functionality for implementing probing in knative serving.
Package prober contains functionality for implementing probing in knative serving.

Jump to

Keyboard shortcuts

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