28 lines
541 B
Go
28 lines
541 B
Go
package server
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
type ServerHandler interface {
|
|
ServerContext() ServerContext
|
|
Init(serverCTX ServerContext) error
|
|
Listen(serverCTX ServerContext) (net.Listener, error)
|
|
OnStart(serverCTX ServerContext)
|
|
|
|
OnError(serverCTX ServerContext, conn net.Conn, 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(serverCTX ServerContext)
|
|
|
|
GetName() string
|
|
|
|
Validate()
|
|
}
|