Documentation ¶
Index ¶
- Variables
- type Server
- func (s *Server) CloseServer() error
- func (s *Server) Handler() fasthttp.RequestHandler
- func (s *Server) IsListening() bool
- func (s *Server) IsSecure() bool
- func (s *Server) Listener() net.Listener
- func (s *Server) OpenServer() (err error)
- func (s *Server) Serve(l net.Listener) error
- func (s *Server) SetHandler(h fasthttp.RequestHandler)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrServerPortAlreadyUsed returns an error with message: 'Server can't run, port is already used' ErrServerPortAlreadyUsed = errors.New("Server can't run, port is already used") // ErrServerAlreadyStarted returns an error with message: 'Server is already started and listening' ErrServerAlreadyStarted = errors.New("Server is already started and listening") // ErrServerOptionsMissing returns an error with message: 'You have to pass iris.ServerOptions' ErrServerOptionsMissing = errors.New("You have to pass iris.ServerOptions") // ErrServerTLSOptionsMissing returns an error with message: 'You have to set CertFile and KeyFile to iris.ServerOptions before ListenTLS' ErrServerTLSOptionsMissing = errors.New("You have to set CertFile and KeyFile to iris.ServerOptions before ListenTLS") // ErrServerIsClosed returns an error with message: 'Can't close the server, propably is already closed or never started' ErrServerIsClosed = errors.New("Can't close the server, propably is already closed or never started") // ErrServerUnknown returns an error with message: 'Unknown reason from Server, please report this as bug!' ErrServerUnknown = errors.New("Unknown reason from Server, please report this as bug!") // ErrParsedAddr returns an error with message: 'ListeningAddr error, for TCP and UDP, the syntax of ListeningAddr is host:port, like 127.0.0.1:8080. // If host is omitted, as in :8080, Listen listens on all available interfaces instead of just the interface with the given host address. // See Dial for more details about address syntax' ErrParsedAddr = errors.New("ListeningAddr error, for TCP and UDP, the syntax of ListeningAddr is host:port, like 127.0.0.1:8080. If host is omitted, as in :8080, Listen listens on all available interfaces instead of just the interface with the given host address. See Dial for more details about address syntax") // ErrServerRemoveUnix returns an error with message: 'Unexpected error when trying to remove unix socket file +filename: +specific error"' ErrServerRemoveUnix = errors.New("Unexpected error when trying to remove unix socket file. Addr: %s | Trace: %s") // ErrServerChmod returns an error with message: 'Cannot chmod +mode for +host:+specific error ErrServerChmod = errors.New("Cannot chmod %#o for %q: %s") )
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { *fasthttp.Server Config config.Server // contains filtered or unexported fields }
Server is the IServer's implementation, holds the fasthttp's Server, a net.Listener, the ServerOptions, and the handler handler is registed at the Station/Iris level
func (*Server) Handler ¶
func (s *Server) Handler() fasthttp.RequestHandler
Handler returns the fasthttp.RequestHandler which is registed to the Server
func (*Server) IsListening ¶
IsListening returns true if server is listening/started, otherwise false
func (*Server) OpenServer ¶
OpenServer opens/starts/runs/listens (to) the server, listenTLS if Cert && Key is registed, listenUnix if Mode is registed, otherwise listen instead of return an error this is panics on any server's error
func (*Server) Serve ¶
Serve just serves a listener, it is a blocking action, plugin.PostListen is not fired here.
func (*Server) SetHandler ¶
func (s *Server) SetHandler(h fasthttp.RequestHandler)
SetHandler sets the handler in order to listen on new requests, this is done at the Station/Iris level