server

package
v0.0.0-...-8846729 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProvider

type AuthProvider struct {
	Creds credentials.TransportCredentials
	// contains filtered or unexported fields
}

func NewAuthProvider

func NewAuthProvider(creds credentials.TransportCredentials, logger *zap.Logger) *AuthProvider

func (*AuthProvider) UnaryInterceptor

func (a *AuthProvider) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

type GrpcApi

type GrpcApi interface {
	Register(server grpc.ServiceRegistrar)
}

func Collection

func Collection(apis ...GrpcApi) GrpcApi

Collection combines multiple GrpcApi instances into a single GrpcApi that all get registered at the same time.

type InfoServer

type InfoServer struct {
	info.UnimplementedInfoServer
	// contains filtered or unexported fields
}

func NewInfoServer

func NewInfoServer(logger *zap.Logger) *InfoServer

func (*InfoServer) AddDevice

func (i *InfoServer) AddDevice(device *info.Device) bool

func (*InfoServer) ListDevices

func (i *InfoServer) ListDevices(ctx context.Context, request *info.ListDevicesRequest) (*info.ListDevicesResponse, error)

func (*InfoServer) RemoveDevice

func (i *InfoServer) RemoveDevice(device *info.Device) bool

func (*InfoServer) Shutdown

func (i *InfoServer) Shutdown()

type Server

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

func NewServer

func NewServer(ctx context.Context, auth *AuthProvider, logger *zap.Logger) *Server

func (*Server) RegisterDevice

func (s *Server) RegisterDevice(device *info.Device)

func (*Server) Shutdown

func (s *Server) Shutdown()

func (*Server) Startup

func (s *Server) Startup(address *url.URL) chan error

Jump to

Keyboard shortcuts

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