server/server_handler.go
crusader faa9bd4567 ing
2017-11-15 13:13:47 +09:00

49 lines
942 B
Go

package server
import (
"net"
)
type ServerHandler interface {
// Init invoked before the server is started
// If you override ths method, must call
//
// func (sh *ServerHandler) Init() error {
// if err := sh.ServerHandler.Init(); nil != err {
// return err
// }
// ...
// return nil
// }
Init() error
Listen() (net.Listener, error)
// OnStart invoked when server is started
// If you override ths method, must call
//
// func (sh *ServerHandler) OnStart() error {
// sh.ServerHandler.OnStart()
// ...
// return nil
// }
OnStart()
OnConnect(conn net.Conn) (net.Conn, error)
Handle(conn net.Conn, stopChan <-chan struct{}, doneChan chan<- struct{})
OnError(status int, reason error)
// OnStop invoked when server is stopped
// If you override ths method, must call
//
// func (sh *ServerHandler) OnStop() {
// ...
// sh.ServerHandler.OnStop()
// }
OnStop()
GetName() string
Validate()
}