builder

package
v0.0.0-...-549d4bb Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 33 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGatewayAllowedHeaders = []string{
	headers.Authorization,
	headers.ContentType,
	headers.IfMatch,
	headers.IfNoneMatch,
	"Depth",
}
View Source
var DefaultGatewayAllowedMethods = []string{
	http.MethodGet,
	http.MethodPost,
	http.MethodHead,
	http.MethodDelete,
	http.MethodPut,
	http.MethodPatch,
	"PROPFIND",
	"MKCOL",
	"COPY",
	"MOVE",
}
View Source
var DefaultGatewayAllowedOrigins = []string{
	"http://localhost",
	"http://localhost:*",
	"https://localhost",
	"https://localhost:*",
	"http://127.0.0.1",
	"http://127.0.0.1:*",
	"https://127.0.0.1",
	"https://127.0.0.1:*",
}
View Source
var TraceContextHeaders = []string{"Traceparent", "Tracestate"}

TraceContextHeaders are the W3C Trace Context propagation headers. They are always forwarded to gRPC metadata, whatever allowed_headers is configured to, because the Authorization Decision Log has to record the trace context of the caller: a decision that arrives over the REST gateway without them would be logged under a freshly minted trace, breaking correlation with the transaction it belongs to.

grpc-gateway's DefaultHeaderMatcher drops them - traceparent/tracestate are not IANA "permanent" message headers - so matching them has to be explicit.

Functions

This section is empty.

Types

type API

type API struct {
	Needs []string `json:"needs"`
	GRPC  struct {
		FQDN          string `json:"fqdn"`
		ListenAddress string `json:"listen_address"`
		// Default connection timeout is 120 seconds
		// https://godoc.org/google.golang.org/grpc#ConnectionTimeout
		ConnectionTimeoutSeconds uint32           `json:"connection_timeout_seconds"`
		Certs                    aserto.TLSConfig `json:"certs"`
	} `json:"grpc"`
	Gateway struct {
		FQDN              string           `json:"fqdn"`
		ListenAddress     string           `json:"listen_address"`
		AllowedOrigins    []string         `json:"allowed_origins"`
		AllowedHeaders    []string         `json:"allowed_headers"`
		AllowedMethods    []string         `json:"allowed_methods"`
		Certs             aserto.TLSConfig `json:"certs"`
		HTTP              bool             `json:"http"`
		ReadTimeout       time.Duration    `json:"read_timeout"`
		ReadHeaderTimeout time.Duration    `json:"read_header_timeout"`
		WriteTimeout      time.Duration    `json:"write_timeout"`
		IdleTimeout       time.Duration    `json:"idle_timeout"`
	} `json:"gateway"`
}

type GRPCOptions

type GRPCOptions struct {
	ServerOptions []grpc.ServerOption
	Registrations GRPCRegistrations
}

type GRPCRegistrations

type GRPCRegistrations func(server *grpc.Server)

type Gateway

type Gateway struct {
	Server *http.Server
	Mux    *http.ServeMux
	Certs  *aserto.TLSConfig
}

type GatewayOptions

type GatewayOptions struct {
	HandlerRegistrations HandlerRegistrations
	ErrorHandler         runtime.ErrorHandlerFunc
}

type HandlerRegistrations

type HandlerRegistrations func(ctx context.Context, mux *runtime.ServeMux, grpcEndpoint string, opts []grpc.DialOption) error

type Health

type Health struct {
	Server     *health.Server
	GRPCServer *grpc.Server
	Address    string
}

func (*Health) SetServiceStatus

func (h *Health) SetServiceStatus(service string, status healthpb.HealthCheckResponse_ServingStatus)

type Service

type Service struct {
	Config   *API
	Server   *grpc.Server
	Listener net.Listener
	Gateway  *Gateway
	Started  chan bool
	Cleanup  []func()
}

type ServiceFactory

type ServiceFactory struct{}

func NewServiceFactory

func NewServiceFactory() *ServiceFactory

func (*ServiceFactory) CreateService

func (f *ServiceFactory) CreateService(
	config *API,
	grpcOpts *GRPCOptions,
	gatewayOpts *GatewayOptions,
	cleanup ...func(),
) (*Service, error)

type ServiceInterface

type ServiceInterface interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

type ServiceManager

type ServiceManager struct {
	Context context.Context

	Servers       map[string]*Service
	DependencyMap map[string][]string
	HealthServer  *Health
	MetricServer  *http.Server
	// contains filtered or unexported fields
}

func NewServiceManager

func NewServiceManager(logger *zerolog.Logger) *ServiceManager

func (*ServiceManager) AddGRPCServer

func (s *ServiceManager) AddGRPCServer(server *Service) error

func (*ServiceManager) SetupHealthServer

func (s *ServiceManager) SetupHealthServer(address string, certCfg *aserto.TLSConfig) error

func (*ServiceManager) SetupMetricsServer

func (s *ServiceManager) SetupMetricsServer(address string, certCfg *aserto.TLSConfig, enableZpages bool) ([]grpc.ServerOption,
	error,
)

func (*ServiceManager) StartServers

func (s *ServiceManager) StartServers(ctx context.Context) error

func (*ServiceManager) StopServers

func (s *ServiceManager) StopServers()

type ServiceTypes

type ServiceTypes interface {
	AvailableServices() []string
	GetGRPCRegistrations(services ...string) GRPCRegistrations
	GetGatewayRegistration(port string, services ...string) HandlerRegistrations
	Close()
}

Jump to

Keyboard shortcuts

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