service

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: CC0-1.0, CC0-1.0, CC0-1.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags() []flag.Flag

Flags returns the flags for the services.

func Serve

func Serve(ctx context.Context, options ...Option) error

Serve starts the services accepting connections. Serve blocks until an error occurs, or until the context fires (which triggers a graceful shutdown). This should only be called after the flags have been parsed.

Types

type CreateServerFunc

type CreateServerFunc func(context.Context, *Options, log.Interface) (grpcutil.Server, error)

CreateServerFunc is a function to create a server.

type Info

type Info struct {
	Name           string           // The service name
	DefaultTCPPort int              // The default TCP port
	DefaultWSPort  int              // The default websocket port
	Create         CreateServerFunc // The creation func
	Addr           *address.Address // The default server address
	Env            string           // The env name used to set the server address
}

Info is the info describing a service.

func (*Info) Register

func (info *Info) Register() error

Register registers a service.

func (*Info) Validate

func (info *Info) Validate() error

Validate validates the data.

type Option

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

Option sets options on a server.

func Log

func Log(lg log.Interface) Option

Log sets the destination log.

func MaxNumConnections

func MaxNumConnections(n int) Option

MaxNumConnections sets the maximum number of connections per socket.

func SSLCert

func SSLCert(crt []byte) Option

SSLCert adds the given SSL certificate.

func SSLCertAndKey

func SSLCertAndKey(crt []byte, key []byte) Option

SSLCertAndKey adds the given SSL public certificate and private key pair.

type Options

type Options struct {
	Address    *address.Address // The address
	SSLCert    []byte           // The SSL certificate
	SSLKeyCert []byte           // The server's SSL (public) certificate
	SSLKey     []byte           // The server's SSL (private) key
}

Options are the options passed to a server on creation.

Jump to

Keyboard shortcuts

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