endpoints

package
v3.0.0-...-0608436 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointControl represents the control endpoint accessible via unix socket.
	EndpointControl = iota

	// EndpointNetwork represents the user endpoint accessible over https (on a different port to the user endpoint).
	EndpointNetwork
)
View Source
const (
	// EndpointsUnix represents the name of the Unix endpoints.
	EndpointsUnix string = "unix"

	// EndpointsCore represents the name of the core API endpoints.
	EndpointsCore string = "core"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint interface {
	Listen() error
	Serve()
	Close() error
	Type() EndpointType
}

Endpoint represents the common methods of an Endpoint.

type EndpointType

type EndpointType int

EndpointType enumerates the supported endpoints.

func (EndpointType) String

func (et EndpointType) String() string

String labels EndpointTypes for logging purposes.

type Endpoints

type Endpoints struct {
	// contains filtered or unexported fields
}

Endpoints represents all listeners and servers for the microcluster daemon REST API.

func NewEndpoints

func NewEndpoints(shutdownCtx context.Context, endpoints map[string]Endpoint) *Endpoints

NewEndpoints aggregates the given endpoints so we can manage them from one source.

func (*Endpoints) Add

func (e *Endpoints) Add(endpoints map[string]Endpoint) error

Add calls Serve on the additional set of listeners, and adds them to Endpoints.

func (*Endpoints) Down

func (e *Endpoints) Down(types ...EndpointType) error

Down closes all of the configured listeners, or any for the type specifically supplied.

func (*Endpoints) DownByName

func (e *Endpoints) DownByName(name string) error

DownByName closes the configured listeners based on its name.

func (*Endpoints) Get

func (e *Endpoints) Get(name string) Endpoint

Get returns a specific endpoint based on its name.

func (*Endpoints) List

func (e *Endpoints) List(types ...EndpointType) map[string]Endpoint

List returns a list of already added endpoints.

func (*Endpoints) Up

func (e *Endpoints) Up() error

Up calls Serve on each of the configured listeners.

func (*Endpoints) UpdateTLSByName

func (e *Endpoints) UpdateTLSByName(name string, cert *shared.CertInfo)

UpdateTLSByName updates the TLS configuration of the network listeners. In case the cluster certificate gets updated reload the core.

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network represents an HTTPS listener and its server.

func NewNetwork

func NewNetwork(ctx context.Context, endpointType EndpointType, server *http.Server, address api.URL, cert *shared.CertInfo) *Network

NewNetwork assigns an address, certificate, and server to the Network.

func (*Network) Close

func (n *Network) Close() error

Close the listener.

func (*Network) Listen

func (n *Network) Listen() error

Listen on the given address.

func (*Network) Serve

func (n *Network) Serve()

Serve binds to the Network's server.

func (*Network) TLS

func (n *Network) TLS() *shared.CertInfo

TLS returns the network's certificate information.

func (*Network) Type

func (n *Network) Type() EndpointType

Type returns the type of the Endpoint.

func (*Network) UpdateTLS

func (n *Network) UpdateTLS(cert *shared.CertInfo)

UpdateTLS updates the TLS configuration of the network listener.

type Socket

type Socket struct {
	Path  string
	Group string
	// contains filtered or unexported fields
}

Socket represents a unix socket with a given path.

func NewSocket

func NewSocket(ctx context.Context, server *http.Server, path api.URL, group string) *Socket

NewSocket returns a Socket struct with no listener attached yet.

func (*Socket) Close

func (s *Socket) Close() error

Close the Socket's listener.

func (*Socket) Listen

func (s *Socket) Listen() error

Listen on the unix socket path.

func (*Socket) Serve

func (s *Socket) Serve()

Serve binds to the Socket's server.

func (*Socket) Type

func (s *Socket) Type() EndpointType

Type returns the type of the Endpoint.

Jump to

Keyboard shortcuts

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