services

package
v0.15.9 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package services contains the gRPC server for inter-node communication.

Index

Constants

View Source
const DefaultGRPCListenAddress = "[::]:8443"

DefaultGRPCListenAddress is the default listen address for the gRPC server.

View Source
const DefaultGRPCPort = 8443

DefaultGRPCPort is the default port for the gRPC server.

Variables

This section is empty.

Functions

func GetByType added in v0.13.7

func GetByType[T any](srvs MeshServers, t T) (T, bool)

GetByType is a generic function that can be used to search for the given server and automatically convert it to the given type.

Types

type LibP2POptions added in v0.15.0

type LibP2POptions struct {
	// HostOptions are options for the libp2p host.
	HostOptions libp2p.HostOptions
	// Announce will announce the host on the DHT at the given rendezvous if true.
	Announce bool
	// Rendezvous is the rendezvous string to use for libp2p.
	Rendezvous string
}

LibP2POptions are options for serving the gRPC server over libp2p.

type MeshServer added in v0.3.1

type MeshServer interface {
	// ListenAndServe starts the server and blocks until the server exits.
	ListenAndServe() error
	// Shutdown attempts to stops the server gracefully.
	Shutdown(ctx context.Context) error
}

MeshServer is the generic interface for additional services that can be managed by this server.

type MeshServers added in v0.13.7

type MeshServers []MeshServer

MeshServers is a list of MeshServers.

func (MeshServers) GetByType added in v0.13.7

func (s MeshServers) GetByType(t any) (MeshServer, bool)

GetByType iterates the list of given servers and returns one of the given type.

type Options

type Options struct {
	// DisableGRPC disables the gRPC server and only runs the MeshServers.
	DisableGRPC bool
	// WebEnabled is true if the grpc-web server should be enabled.
	WebEnabled bool
	// ListenAddress is the address to start the gRPC server on.
	ListenAddress string
	// ServerOptions are options for the server. This should include
	// any registered authentication mechanisms.
	ServerOptions []grpc.ServerOption
	// LibP2POptions are options for serving the gRPC server over libp2p.
	LibP2POptions *LibP2POptions
	// Servers are additional servers to manage alongside the gRPC server.
	Servers MeshServers
}

Options contains the configuration for the gRPC server.

func (*Options) GetServer added in v0.13.7

func (o *Options) GetServer(typ any) (MeshServer, bool)

GetServer returns the server of the given type.

type Server

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

Server is the gRPC server.

func NewServer

func NewServer(ctx context.Context, o Options) (*Server, error)

NewServer returns a new Server. TODO: We need to dynamically expose certain services only to the internal mesh.

func (*Server) GRPCListenPort added in v0.13.0

func (s *Server) GRPCListenPort() int

GRPCListenPort returns the port the gRPC server is listening on.

func (*Server) GetServiceInfo

func (s *Server) GetServiceInfo() map[string]grpc.ServiceInfo

GetServiceInfo implements reflection.ServiceInfoProvider.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the gRPC server and optional metrics server then blocks until the gRPC server exits.

func (*Server) RegisterService

func (s *Server) RegisterService(desc *grpc.ServiceDesc, impl any)

RegisterService implements grpc.RegistrarService.

func (*Server) Shutdown added in v0.3.1

func (s *Server) Shutdown(ctx context.Context)

Shutdown stops the gRPC server and all mesh services gracefully. You cannot use the server again after calling Stop.

Directories

Path Synopsis
Package admin provides the admin gRPC server.
Package admin provides the admin gRPC server.
Package leaderproxy provides a gRPC interceptor that proxies requests to the leader node.
Package leaderproxy provides a gRPC interceptor that proxies requests to the leader node.
Package membership contains the webmesh membership service.
Package membership contains the webmesh membership service.
Package meshapi contains the webmesh Mesh API service.
Package meshapi contains the webmesh Mesh API service.
Package meshdns contains the Mesh DNS server.
Package meshdns contains the Mesh DNS server.
Package metrics contains the HTTP server for exposing Prometheus metrics.
Package metrics contains the HTTP server for exposing Prometheus metrics.
Package node contains the webmesh node service.
Package node contains the webmesh node service.
Package rbac contains utilities for evaluating requests against roles.
Package rbac contains utilities for evaluating requests against roles.
Package storage provides the storage server.
Package storage provides the storage server.
Package turn contains the STUN/TURN server.
Package turn contains the STUN/TURN server.
Package webrtc contains the webmesh WebRTC service.
Package webrtc contains the webmesh WebRTC service.

Jump to

Keyboard shortcuts

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