Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExceptionHandler ¶ added in v0.3.0
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 {
// contains filtered or unexported fields
}
Server is an HTTP to GRPC proxy server
func NewServer ¶
NewServer 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) Proxy ¶
func (s *Server) Proxy(ctx context.Context, req *httpapi.Request) (res *httpapi.Response, err error)
Proxy proxies connections through the server
func (*Server) SetExceptionHandler ¶ added in v0.3.0
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