api

package
v0.75.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GRPC          grpc.Config   `group:"grpc api"                                           namespace:"grpc"`
	GRPCUI        GRPCUIConfig  `group:"grpc web ui"                                        namespace:"grpcui"`
	REST          RESTConfig    `group:"rest api"                                           namespace:"rest"`
	Gateway       GatewayConfig `group:"gateway"                                            namespace:"grpcui"`
	ListenAddress string        `description:"the IP address that our sever will listen on" long:"listen-address"`
	ListenPort    uint16        `description:"the port that our sever will listen on"       long:"listen-port"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

type GRPCUIConfig

type GRPCUIConfig struct {
	Enabled        encoding.Bool     `long:"enabled"`
	Endpoint       string            `long:"endpoint"`
	Level          encoding.LogLevel `` /* 152-byte string literal not displayed */
	MaxPayloadSize encoding.ByteSize `description:"Maximum size of GRPC messages the UI will accept from the GRPC server (e.g. 4mb)" long:"max-payload-size"`
}

func NewDefaultGRPCUIConfig

func NewDefaultGRPCUIConfig() GRPCUIConfig

type GRPCUIHandler

type GRPCUIHandler struct {
	GRPCUIConfig
	// contains filtered or unexported fields
}

func NewGRPCUIHandler

func NewGRPCUIHandler(log *logging.Logger, dialer grpcDialer, config GRPCUIConfig) *GRPCUIHandler

func (*GRPCUIHandler) Name

func (g *GRPCUIHandler) Name() string

func (*GRPCUIHandler) ServeHTTP

func (g *GRPCUIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*GRPCUIHandler) Start

func (g *GRPCUIHandler) Start(ctx context.Context) error

func (*GRPCUIHandler) Stop added in v0.73.0

func (g *GRPCUIHandler) Stop()

type Gateway

type Gateway struct {
	GatewayConfig
	// contains filtered or unexported fields
}

func NewGateway

func NewGateway(log *logging.Logger, config GatewayConfig, lis net.Listener) *Gateway

func (*Gateway) Register

func (s *Gateway) Register(handler GatewayHandler, endpoint string)

func (*Gateway) Serve

func (s *Gateway) Serve() error

func (*Gateway) Stop added in v0.73.0

func (s *Gateway) Stop()

type GatewayConfig

type GatewayConfig struct {
	CORS libhttp.CORSConfig `description:"CORS allowed origins" long:"cors"`
}

func NewDefaultGatewayConfig

func NewDefaultGatewayConfig() GatewayConfig

type GatewayHandler

type GatewayHandler interface {
	http.Handler
	Name() string
}

type NotStarted

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

func NewNotStartedHandler

func NewNotStartedHandler(name string) *NotStarted

func (*NotStarted) ServeHTTP

func (n *NotStarted) ServeHTTP(w http.ResponseWriter, req *http.Request)

type Portal

type Portal struct {
	Config
	// contains filtered or unexported fields
}

func NewPortal

func NewPortal(config Config, log *logging.Logger) *Portal

func (*Portal) GRPCListener

func (p *Portal) GRPCListener() net.Listener

func (*Portal) GatewayListener

func (p *Portal) GatewayListener() net.Listener

func (*Portal) Serve

func (p *Portal) Serve() error

func (*Portal) Stop added in v0.73.0

func (p *Portal) Stop()

type RESTConfig

type RESTConfig struct {
	Level    encoding.LogLevel `choice:"debug"  choice:"info" choice:"warning" long:"log-level"`
	Enabled  encoding.Bool     `long:"enabled"`
	Endpoint string            `long:"endpoint"`
}

func NewDefaultRESTConfig

func NewDefaultRESTConfig() RESTConfig

type RESTHandler

type RESTHandler struct {
	RESTConfig
	// contains filtered or unexported fields
}

Handler implement a rest server acting as a proxy to the grpc api.

func NewRESTHandler

func NewRESTHandler(log *logging.Logger, dialer grpcDialer, config RESTConfig) *RESTHandler

func (*RESTHandler) Name

func (r *RESTHandler) Name() string

func (*RESTHandler) ServeHTTP

func (r *RESTHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*RESTHandler) Start

func (r *RESTHandler) Start(ctx context.Context) error

func (*RESTHandler) Stop added in v0.73.0

func (r *RESTHandler) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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