Documentation
¶
Index ¶
- Variables
- type ServerInfo
- type ServerListener
- type ServerRouter
- func (sr *ServerRouter) CreateOrUpdateDocument(w http.ResponseWriter, r *http.Request)
- func (sr *ServerRouter) DeleteDocument(w http.ResponseWriter, r *http.Request)
- func (sr *ServerRouter) GetDocument(w http.ResponseWriter, r *http.Request)
- func (sr *ServerRouter) GetServer(w http.ResponseWriter, r *http.Request)
- func (sr *ServerRouter) Index(w http.ResponseWriter, r *http.Request)
- func (sr *ServerRouter) NotSupported(w http.ResponseWriter, r *http.Request)
- func (r *ServerRouter) SetupRoutes()
- func (r *ServerRouter) StartServe()
- func (r *ServerRouter) StopServe()
- func (r *ServerRouter) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var StoppedError = errors.New("Server listener stopped")
Functions ¶
This section is empty.
Types ¶
type ServerInfo ¶
type ServerListener ¶
type ServerListener struct { *net.TCPListener // Backing TCP listener Open bool // Indicator that this listener opened or not // contains filtered or unexported fields }
Custom TCP listener that could receive stop signal inspired by http://www.hydrogen18.com/blog/stop-listening-http-server-go.html
func NewTCPListener ¶
func NewTCPListener(l net.Listener) (*ServerListener, error)
func (*ServerListener) Accept ¶
func (sl *ServerListener) Accept() (net.Conn, error)
Override accept method of backed listener
func (*ServerListener) Close ¶
func (sl *ServerListener) Close() error
type ServerRouter ¶
type ServerRouter struct { Configuration *configs.Config Mux *mux.Router Database *collection.Collection ServerInfo *ServerInfo ServerListener *ServerListener }
func NewRouter ¶
func NewRouter(config *configs.Config, database *collection.Collection) *ServerRouter
func (*ServerRouter) CreateOrUpdateDocument ¶
func (sr *ServerRouter) CreateOrUpdateDocument( w http.ResponseWriter, r *http.Request)
func (*ServerRouter) DeleteDocument ¶
func (sr *ServerRouter) DeleteDocument( w http.ResponseWriter, r *http.Request)
func (*ServerRouter) GetDocument ¶
func (sr *ServerRouter) GetDocument( w http.ResponseWriter, r *http.Request)
func (*ServerRouter) GetServer ¶
func (sr *ServerRouter) GetServer( w http.ResponseWriter, r *http.Request)
func (*ServerRouter) Index ¶
func (sr *ServerRouter) Index(w http.ResponseWriter, r *http.Request)
func (*ServerRouter) NotSupported ¶
func (sr *ServerRouter) NotSupported( w http.ResponseWriter, r *http.Request)
func (*ServerRouter) SetupRoutes ¶
func (r *ServerRouter) SetupRoutes()
func (*ServerRouter) StartServe ¶
func (r *ServerRouter) StartServe()
func (*ServerRouter) StopServe ¶
func (r *ServerRouter) StopServe()
func (*ServerRouter) String ¶
func (r *ServerRouter) String() string
Click to show internal directories.
Click to hide internal directories.