Documentation
¶
Index ¶
- func MatchAndStripMethodName(methodName string) (string, string, bool)
- type ExceptionHandler
- type Server
- func (s *Server) ProxyStream(srv httpapi.ExposedService_ProxyStreamServer) (err error)
- func (s *Server) ProxyUnary(ctx context.Context, req *httpapi.Request) (res *httpapi.Response, err error)
- func (s *Server) Serve(listener net.Listener) (err error)
- func (s *Server) SetExceptionHandler(handler ExceptionHandler)
- func (s *Server) SetSelfConnection(selfConnection interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExceptionHandler ¶
type ExceptionHandler func(ctx context.Context, req *httpapi.Request) (handled bool, res *httpapi.Response, err error)
ExceptionHandler is an exception handler function
type Server ¶
type Server struct { httpapi.UnimplementedExposedServiceServer // contains filtered or unexported fields }
Server is an HTTP to GRPC proxy server
func NewServer ¶
NewServer creates a proxy from HTTP(S) traffic to a self-connection using the methods defined by api api should be the Unimplemented<ServiceName> struct compiled by the protobuf. All methods defined on api MUST start with an HTTP method name server MUST implement the same methods as api without the prepended method names, though it may have others without exposing them to HTTP(S) traffic
func NewServerNoInterceptorSupport ¶ added in v0.10.0
func NewServerNoInterceptorSupport(api, server interface{}, listener *grpc.Server) (s *Server, err error)
NewServerNoInterceptorSupport creates a proxy from HTTP(S) traffic to server using the methods defined by api api should be the Unimplemented<ServiceName> struct compiled by the protobuf. All methods defined on api MUST start with an HTTP method name server MUST implement the same methods as api without the prepended method names, though it may have others without exposing them to HTTP(S) traffic
func (*Server) ProxyStream ¶
func (s *Server) ProxyStream(srv httpapi.ExposedService_ProxyStreamServer) (err error)
ProxyStream streams requests and responses in both directions in any order
func (*Server) ProxyUnary ¶
func (s *Server) ProxyUnary(ctx context.Context, req *httpapi.Request) (res *httpapi.Response, err error)
ProxyUnary proxies connections through the server
func (*Server) SetExceptionHandler ¶
func (s *Server) SetExceptionHandler(handler ExceptionHandler)
SetExceptionHandler sets a function which is called before auto-proxying a request. This function may return handled = false to indicate it did not handle the request and it should be auto-proxied as usual. If handled is returned true, the proxy will assume the request has been handled already and will immediately return res and error
func (*Server) SetSelfConnection ¶ added in v0.10.0
SetSelfConnection sets the self-connection to which requests should be proxied.