service

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOptions

func NewOptions() *options

Types

type Middleware

type Middleware = alice.Constructor

type Option

type Option func(*options)

func NewFlagSet

func NewFlagSet() (*pflag.FlagSet, Option)

func WithAddress

func WithAddress(addr string) Option

WithAddress sets the address of the server

func WithAfterStart

func WithAfterStart(fn ...func() error) Option

func WithAfterStop

func WithAfterStop(fn ...func() error) Option

func WithBeforeStart

func WithBeforeStart(fn ...func() error) Option

func WithBeforeStop

func WithBeforeStop(fn ...func() error) Option

func WithCACert

func WithCACert(path string) Option

func WithCert

func WithCert(path string) Option

func WithClientInterceptors

func WithClientInterceptors(i ...interceptors.ClientInterceptors) Option

func WithContext

func WithContext(ctx context.Context) Option

WithContext specifies a context for the service. Can be used to signal shutdown of the service. Can be used for extra option values.

func WithCors

func WithCors(opts cors.Options) Option

func WithGRPCServerOpts

func WithGRPCServerOpts(opts ...grpc.ServerOption) Option

func WithGRPCWeb

func WithGRPCWeb(b bool) Option

func WithGRPCWebOpts

func WithGRPCWebOpts(opts ...grpcweb.Option) Option

func WithGRPCWebPrefix

func WithGRPCWebPrefix(prefix string) Option

func WithGateway

func WithGateway(fn RegisterGatewayFunc) Option

func WithGatewayOpts

func WithGatewayOpts(opts ...runtime.ServeMuxOption) Option

func WithGatewayPrefix

func WithGatewayPrefix(prefix string) Option

func WithHealth

func WithHealth(h bool) Option

func WithInterceptors

func WithInterceptors(i ...interceptors.Interceptors) Option

func WithKey

func WithKey(path string) Option

func WithListener

func WithListener(lis net.Listener) Option

WithListener specifies a listener for the service. It can be used to specify a custom listener. This will override the WithAddress and WithTLSConfig options

func WithMiddlewares

func WithMiddlewares(m ...Middleware) Option

func WithMux

func WithMux(mux ServeMux) Option

func WithName

func WithName(name string) Option

func WithReactUI

func WithReactUI(fs fs.FS, subpath string) Option

WithReactUI add static single page app serving to the http server subpath is the path in the read-only file embed.FS to use as root to serve static content

func WithReflection

func WithReflection(r bool) Option

func WithRegistry

func WithRegistry(registry registry.Registry) Option

func WithSecure

func WithSecure(s bool) Option

func WithServerInterceptors

func WithServerInterceptors(i ...interceptors.ServerInterceptors) Option

func WithStreamClientInterceptor

func WithStreamClientInterceptor(i ...grpc.StreamClientInterceptor) Option

func WithStreamServerInterceptor

func WithStreamServerInterceptor(i ...grpc.StreamServerInterceptor) Option

func WithSubscriberInterceptor

func WithSubscriberInterceptor(w ...interface{}) Option

WithSubscriberInterceptor adds subscriber interceptors to the options passed into the server

func WithTLSConfig

func WithTLSConfig(conf *tls.Config) Option

func WithUnaryClientInterceptor

func WithUnaryClientInterceptor(i ...grpc.UnaryClientInterceptor) Option

func WithUnaryServerInterceptor

func WithUnaryServerInterceptor(i ...grpc.UnaryServerInterceptor) Option

WithUnaryServerInterceptor adds unary Wrapper interceptors to the options passed into the server

func WithVersion

func WithVersion(version string) Option

type Options

type Options interface {
	Context() context.Context
	Name() string
	Version() string
	Address() string

	Reflection() bool
	Health() bool

	CACert() string
	Cert() string
	Key() string
	TLSConfig() *tls.Config
	Secure() bool

	Registry() registry.Registry

	BeforeStart() []func() error
	AfterStart() []func() error
	BeforeStop() []func() error
	AfterStop() []func() error

	ServerOpts() []grpc.ServerOption
	ServerInterceptors() []grpc.UnaryServerInterceptor
	StreamServerInterceptors() []grpc.StreamServerInterceptor

	ClientInterceptors() []grpc.UnaryClientInterceptor
	StreamClientInterceptors() []grpc.StreamClientInterceptor

	Cors() cors.Options
	Mux() ServeMux
	GRPCWeb() bool
	GRPCWebPrefix() string
	GRPCWebOpts() []grpcweb.Option

	Gateway() bool
	GatewayPrefix() string
	GatewayOpts() []runtime.ServeMuxOption

	Default()
}

type RegisterGatewayFunc

type RegisterGatewayFunc func(ctx context.Context, mux *runtime.ServeMux, cc grpc.ClientConnInterface) error

type ServeMux

type ServeMux interface {
	ServeHTTP(http.ResponseWriter, *http.Request)
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

type Service

type Service interface {
	greflect.GRPCServer

	Options() Options
	Start() error
	Stop() error
	Close() error
}

func New

func New(opts ...Option) (Service, error)

Jump to

Keyboard shortcuts

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