Documentation ¶
Index ¶
- func RequestFromServerContext(ctx context.Context) (*http.Request, bool)
- func SetOperation(ctx context.Context, op string)
- type FilterFunc
- type Server
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) Health() bool
- func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Use(selector string, m ...middleware.Middleware)
- type ServerOption
- func Address(addr string) ServerOption
- func Filter(filters ...FilterFunc) ServerOption
- func Listener(lis net.Listener) ServerOption
- func Middleware(m ...middleware.Middleware) ServerOption
- func Network(network string) ServerOption
- func ReadTimeout(timeout time.Duration) ServerOption
- func TLSConfig(c *tls.TLS) ServerOption
- func Timeout(timeout time.Duration) ServerOption
- type Transport
- func (tr *Transport) Endpoint() string
- func (tr *Transport) Kind() transport.Kind
- func (tr *Transport) Operation() string
- func (tr *Transport) PathTemplate() string
- func (tr *Transport) ReplyHeader() transport.Header
- func (tr *Transport) Request() *http.Request
- func (tr *Transport) RequestHeader() transport.Header
- type Transporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestFromServerContext ¶
RequestFromServerContext returns request from context.
func SetOperation ¶
SetOperation sets the transport operation.
Types ¶
type FilterFunc ¶
FilterFunc is a function which receives a http.Handler and returns another http.Handler.
func FilterChain ¶
func FilterChain(filters ...FilterFunc) FilterFunc
FilterChain returns a FilterFunc that specifies the chained handler for HTTP Router.
type Server ¶
Server is an HTTP server wrapper.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
NewServer creates an HTTP server by options.
func (*Server) Endpoint ¶
Endpoint return a real address to registry endpoint. examples:
https://127.0.0.1:8000 Legacy: http://127.0.0.1:8000?isSecure=false
func (*Server) Use ¶
func (s *Server) Use(selector string, m ...middleware.Middleware)
Use uses a service middleware with selector. selector:
- '/*'
- '/helloworld.v1.Greeter/*'
- '/helloworld.v1.Greeter/SayHello'
type ServerOption ¶
type ServerOption func(*Server)
ServerOption is an HTTP server option.
func Middleware ¶
func Middleware(m ...middleware.Middleware) ServerOption
Middleware with service middleware option.
func ReadTimeout ¶
func ReadTimeout(timeout time.Duration) ServerOption
ReadTimeout with server timeout.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is an HTTP transport.
func (*Transport) PathTemplate ¶
PathTemplate returns the http path template.
func (*Transport) ReplyHeader ¶ added in v1.10.0
ReplyHeader returns the reply header.
func (*Transport) RequestHeader ¶ added in v1.10.0
RequestHeader returns the request header.
type Transporter ¶
type Transporter interface { transport.Transporter Request() *http.Request PathTemplate() string }
Transporter is http Transporter