Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( GRPCPort = flag.Int("grpc_port", 2020, "Port of a gRPC listener.") GatewayPort = flag.Int("grpc_gateway_port", 8080, "Port of a gRPC gateway instance.") HTTPPort = flag.Int("http_port", 8888, "Port of a HTTP listener.") ShutdownWait = flag.Duration("shutdown_wait", 15*time.Second, "How long to wait for server connections to drain.") CORSAllowAll = flag.Bool("cors_allow_all", true, "Set CORS headers to allow all requests?") SlowReplies = flag.Bool("slow_replies", false, "Make all requests take an extra second.") StaticDir = flag.String("static_dir", "./frontend/build", "Directory to serve static files from.") )
Functions ¶
func ServerValidationUnaryInterceptor ¶
func ServerValidationUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
ServerValidationUnaryInterceptor returns a new unary server interceptor that validates incoming requests.
Types ¶
type ApoxyServer ¶
type ApoxyServer struct { Mux *http.ServeMux Srv *http.Server Context context.Context GRPC *grpc.Server Gateway *runtime.ServeMux GwSrv *http.Server // contains filtered or unexported fields }
func NewApoxyServer ¶
func NewApoxyServer(opts ...ServerOption) *ApoxyServer
NewApoxyServer returns a new gRPC server.
func (*ApoxyServer) Run ¶
func (s *ApoxyServer) Run()
func (*ApoxyServer) Shutdown ¶
func (s *ApoxyServer) Shutdown()
type GatewayHandlerFn ¶
type ServerOption ¶
type ServerOption func(*serverOptions)
ServerOption sets Apoxy server options.
func WithHandlers ¶
func WithHandlers(handlers ...GatewayHandlerFn) ServerOption
WithHandlers appends handlers to the list of gRPC handlers of the server.
func WithPassedHeader ¶
func WithPassedHeader(key string) ServerOption
WithPassedHeader enables passing of HTTP header to the corresponding gRPC handler via context. The header will be prefixed with grpcserver-.
Click to show internal directories.
Click to hide internal directories.