Documentation
¶
Overview ¶
Package http implements the HTTP transport protocol.
Index ¶
Constants ¶
View Source
const ( DebugMode = "debug" TestMode = "testing" ReleaseMode = "release" )
Variables ¶
Functions ¶
Types ¶
type Option ¶ added in v0.6.0
type Option func(*Options)
func WithReadTimeout ¶ added in v0.6.0
WithReadTimeout sets the read-timeout for the HTTP server.
func WithWriteTimeout ¶ added in v0.6.0
WithWriteTimeout sets the write-timeout for the HTTP server.
type Options ¶
type Options struct {
// The hostname of the HTTP server.
Host string
// The port of the HTTP server.
Port int
// Read timeout for the HTTP server.
ReadTimeout time.Duration
// Write timeout for the HTTP server.
WriteTimeout time.Duration
// Mode of the HTTP server. Includes DebugMode, TestMode, and ReleaseMode.
Mode string
}
Options for the HTTP server.
type Server ¶
type Server struct {
Name string
Version string
*Options
// contains filtered or unexported fields
}
Server is the HTTP server.
func New ¶
func New(logger *zap.Logger, router *echo.Echo, registrar registry.Registrar, opts ...Option) *Server
New creates a new HTTP server.
The default options are:
- ReadTimeout: DefaultReadTimeout
- WriteTimeout: DefaultWriteTimeout
- Mode: DebugMode
func (*Server) GetID ¶
GetID returns the unique identifier of the server. It is useful when a service starts more than one server.
func (*Server) IntranetAddr ¶
func (*Server) Service ¶
func (s *Server) Service() *registry.ServiceInstance
Click to show internal directories.
Click to hide internal directories.