server

package
v1.52.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server contains internal server-side functionality used by the public facing xds package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewListenerWrapper

func NewListenerWrapper(params ListenerWrapperParams) (net.Listener, <-chan struct{})

NewListenerWrapper creates a new listenerWrapper with params. It returns a net.Listener and a channel which is written to, indicating that the former is ready to be passed to grpc.Serve().

Only TCP listeners are supported.

Types

type DrainCallback added in v1.41.0

type DrainCallback func(addr net.Addr)

DrainCallback is the callback that an xDS-enabled server registers to get notified about updates to the Listener configuration. The server is expected to gracefully shutdown existing connections, thereby forcing clients to reconnect and have the new configuration applied to the newly created connections.

type ListenerWrapperParams

type ListenerWrapperParams struct {
	// Listener is the net.Listener passed by the user that is to be wrapped.
	Listener net.Listener
	// ListenerResourceName is the xDS Listener resource to request.
	ListenerResourceName string
	// XDSCredsInUse specifies whether or not the user expressed interest to
	// receive security configuration from the control plane.
	XDSCredsInUse bool
	// XDSClient provides the functionality from the XDSClient required here.
	XDSClient XDSClient
	// ModeCallback is the callback to invoke when the serving mode changes.
	ModeCallback ServingModeCallback
	// DrainCallback is the callback to invoke when the Listener gets a LDS
	// update.
	DrainCallback DrainCallback
}

ListenerWrapperParams wraps parameters required to create a listenerWrapper.

type ServingModeCallback added in v1.38.0

type ServingModeCallback func(addr net.Addr, mode connectivity.ServingMode, err error)

ServingModeCallback is the callback that users can register to get notified about the server's serving mode changes. The callback is invoked with the address of the listener and its new mode. The err parameter is set to a non-nil error if the server has transitioned into not-serving mode.

type XDSClient added in v1.39.0

type XDSClient interface {
	WatchListener(string, func(xdsresource.ListenerUpdate, error)) func()
	WatchRouteConfig(string, func(xdsresource.RouteConfigUpdate, error)) func()
	BootstrapConfig() *bootstrap.Config
}

XDSClient wraps the methods on the XDSClient which are required by the listenerWrapper.

Jump to

Keyboard shortcuts

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