endpoints

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 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
)

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 ...Endpoint) *Endpoints

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

func (*Endpoints) Add

func (e *Endpoints) Add(endpoints ...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) Up

func (e *Endpoints) Up() error

Up calls Serve on each of the configured listeners.

func (*Endpoints) UpdateTLS

func (e *Endpoints) UpdateTLS(cert *shared.CertInfo)

UpdateTLS updates the TLS configuration of the network listeners.

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) 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