server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadProtocolExpectingAddress = errors.New("bad protocol: expecting address")
View Source
var InvalidToken = errors.New("invalid token")
View Source
var NotAcceptingConnections = errors.New("not accepting connections")
View Source
var ServerShuttingDown = errors.New("server is shutting down")

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

Types

type Config

type Config struct {
	Services map[string]ServiceConfig
	grpcapi.TLSConfig
	Log               *log.Logger
	AcceptTimeout     time.Duration
	EnableOpenTracing bool
	EnablePrometheus  bool
	OnAuthFunc        grpc_auth.AuthFunc
	OnListenFunc      func(ctx context.Context, service string) (string, func(), error)
	OnConnectFunc     func(ctx context.Context, service string) (string, func(), error)
}

type Server

type Server struct {
	*grpc.Server

	OnListenFunc  func(ctx context.Context, service string) (string, func(), error)
	OnConnectFunc func(ctx context.Context, service string) (string, func(), error)
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Server, error)

func (*Server) AcceptConnection

func (s *Server) AcceptConnection(acceptStream grpcapi.RemoteHost_AcceptConnectionServer) error

func (*Server) Connect

func (s *Server) Connect(grpcConnnection grpcapi.RemoteHost_ConnectServer) error

func (*Server) Listen

func (s *Server) Listen(address *grpcapi.ServiceAddress, listenServer grpcapi.RemoteHost_ListenServer) error

func (*Server) SetServices

func (s *Server) SetServices(services map[string]ServiceConfig)

func (*Server) Start

func (s *Server) Start(l net.Listener)

func (*Server) Stop

func (s *Server) Stop()

type ServiceConfig

type ServiceConfig struct {
	Listen   string
	Listener net.Listener
}

Jump to

Keyboard shortcuts

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