server

package
v3.0.0-beta+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

README

Package information

I decide to split the whole server from the main iris package because these files don't depends on any of the iris' types.

That's it.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 New

func New(cfg ...config.Server) *Server

New returns a pointer to a Server object, and set it's options if any, nothing more

func (*Server) CloseServer

func (s *Server) CloseServer() error

CloseServer closes the server

func (*Server) Handler

func (s *Server) Handler() fasthttp.RequestHandler

Handler returns the fasthttp.RequestHandler which is registed to the Server

func (*Server) IsListening

func (s *Server) IsListening() bool

IsListening returns true if server is listening/started, otherwise false

func (*Server) IsSecure

func (s *Server) IsSecure() bool

IsSecure returns true if server uses TLS, otherwise false

func (*Server) Listener

func (s *Server) Listener() net.Listener

Listener returns the net.Listener which this server (is) listening to

func (*Server) OpenServer

func (s *Server) OpenServer() (err error)

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

func (s *Server) Serve(l net.Listener) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL