Documentation ¶
Index ¶
- func TCPControl(network, address string, c syscall.RawConn) error
- type HCControllerOpts
- type HealthCheckController
- func (hc *HealthCheckController) GetHealthy() bool
- func (hc *HealthCheckController) GetHealthyStr() string
- func (hc *HealthCheckController) Start()
- func (hc *HealthCheckController) StartHealth()
- func (hc *HealthCheckController) StartTermination()
- func (hc *HealthCheckController) StartUnhealth()
- func (hc *HealthCheckController) StopTermination()
- type Listener
- type ListenerOptions
- type Protocol
- type Server
- type ServerConfig
- type ServerHTTP
- type ServerTCP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TCPControl ¶
TCPControl set of flags of TCP listener to reuse the socket when the service needs to be restored. This function will work only for unix systems. To port it to other systems, we advise to use the external lib go-reuseport. https://github.com/libp2p/go-reuseport/blob/master/control_unix.go
Types ¶
type HCControllerOpts ¶
type HCControllerOpts struct { Event *event.EventHandler Metric *metric.MetricsHandler TermTimeout uint64 }
type HealthCheckController ¶
type HealthCheckController struct { // Healthy flag. Return true when the termination // flag is not set. Healthy bool HealthSince time.Time UnhealthSince time.Time Event *event.EventHandler Metric *metric.MetricsHandler // contains filtered or unexported fields }
func NewHealthCheckController ¶
func NewHealthCheckController(op *HCControllerOpts) *HealthCheckController
func (*HealthCheckController) GetHealthy ¶
func (hc *HealthCheckController) GetHealthy() bool
func (*HealthCheckController) GetHealthyStr ¶
func (hc *HealthCheckController) GetHealthyStr() string
Returns healthy/unhealthy string
func (*HealthCheckController) Start ¶
func (hc *HealthCheckController) Start()
func (*HealthCheckController) StartHealth ¶
func (hc *HealthCheckController) StartHealth()
func (*HealthCheckController) StartTermination ¶
func (hc *HealthCheckController) StartTermination()
func (*HealthCheckController) StartUnhealth ¶
func (hc *HealthCheckController) StartUnhealth()
func (*HealthCheckController) StopTermination ¶
func (hc *HealthCheckController) StopTermination()
type Listener ¶
type Listener struct { Event *event.EventHandler // contains filtered or unexported fields }
func NewListener ¶
func NewListener(op *ListenerOptions) (*Listener, error)
type ListenerOptions ¶
type ServerConfig ¶
type ServerConfig struct {
// contains filtered or unexported fields
}
type ServerHTTP ¶
type ServerHTTP struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewHTTPServer(cfg *ServerConfig) (*ServerHTTP, error)
func (*ServerHTTP) Start ¶
func (srv *ServerHTTP) Start()
func (*ServerHTTP) StartController ¶
func (srv *ServerHTTP) StartController()
StartController will do nothing in HTTP/S servers (only TCP).
type ServerTCP ¶
type ServerTCP struct {
// contains filtered or unexported fields
}
func NewTCPServer ¶
func NewTCPServer(cfg *ServerConfig) (*ServerTCP, error)
func (*ServerTCP) ControllerWaiter ¶
ControllerWaiter wait in seconds
func (*ServerTCP) ServerPortIsOpen ¶
ServerPortIsOpen checks whether the TCP port is Opened, and return a boolean. True when the TCP Port is opened.
func (*ServerTCP) Start ¶
func (srv *ServerTCP) Start()
Start is responsible to setup the TCP server, listen, and accept new connections routing the connections to the handler with non-blocking allowing parallel connections.
func (*ServerTCP) StartController ¶
func (srv *ServerTCP) StartController()
StartController is a infinity loop to watch the Health Check Controller and force the server to not answer TCP requests when the health check should be in failing state.