api

package
v0.72.0-preview.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 17 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() error

type Gateway

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

func NewGateway

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

func (*Gateway) Register

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

func (*Gateway) Serve

func (s *Gateway) Serve(lis net.Listener) error

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

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() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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