server

package
v0.0.0-...-fc4206c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenHTTP         string
	ListenGRPC         string
	ListenInternalHTTP string
	ListenInternalGRPC string
}

Config is the required configuration for the server.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default config for the server.

func (*Config) Flags

func (c *Config) Flags(prefix string, defaults *Config) *pflag.FlagSet

Flags returns a flagset that can be added to the command line.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an option for the server.

func WithGRPCOptions

func WithGRPCOptions(opts ...grpc.Option) Option

WithGRPCOptions returns an Option that adds the given GRPC options.

func WithHTTPOptions

func WithHTTPOptions(opts ...http.Option) Option

WithHTTPOptions returns an Option that adds the given HTTP options.

func WithInternalGRPCOptions

func WithInternalGRPCOptions(opts ...grpc.Option) Option

WithInternalGRPCOptions returns an Option that adds the given GRPC options for the internal server.

func WithInternalHTTPOptions

func WithInternalHTTPOptions(opts ...http.Option) Option

WithInternalHTTPOptions returns an Option that adds the given HTTP options for the internal server.

type Server

type Server struct {
	GRPC *grpc.Server
	HTTP *http.Server

	InternalGRPC *grpc.Server
	InternalHTTP *http.Server
	// contains filtered or unexported fields
}

Server wraps gRPC and HTTP servers.

func New

func New(config Config, opts ...Option) *Server

New instantiates a new server that uses the config and options.

func (*Server) RegisterTCPServer

func (s *Server) RegisterTCPServer(name, address string, server interface {
	Serve(lis net.Listener) error
	GracefulStop() error
}) error

RegisterTCPServer registers the named TCP server on address.

func (*Server) RegisterUDPServer

func (s *Server) RegisterUDPServer(name, address string, server interface {
	Serve(conn net.PacketConn) error
	GracefulStop() error
}) error

RegisterUDPServer registers the named UDP server on address.

func (*Server) Run

func (s *Server) Run(ctx context.Context) (err error)

Run runs the server until the Done channel of ctx is closed.

Directories

Path Synopsis
Package cookie provides middleware for working with device, session and user session cookies.
Package cookie provides middleware for working with device, session and user session cookies.
Package grpc provides the backbone for a gRPC server with some opinionated defaults.
Package grpc provides the backbone for a gRPC server with some opinionated defaults.
Package http provides the backbone for an HTTP server with some opinionated defaults.
Package http provides the backbone for an HTTP server with some opinionated defaults.
internal
channelz
Package channelz can be used to expose the channelz service on the gRPC server.
Package channelz can be used to expose the channelz service on the gRPC server.
Package packet provides the backbone for a UDP packet server with some opinionated defaults.
Package packet provides the backbone for a UDP packet server with some opinionated defaults.
Package recovery can be used to add panic recovery middleware to the server.
Package recovery can be used to add panic recovery middleware to the server.
Package reflection can be used to support gRPC server reflection on the server.
Package reflection can be used to support gRPC server reflection on the server.
Package stream provides the backbone for a TCP stream server with some opinionated defaults.
Package stream provides the backbone for a TCP stream server with some opinionated defaults.

Jump to

Keyboard shortcuts

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