handler.go 298 B

123456789101112131415
  1. package tcp
  2. import (
  3. "context"
  4. "net"
  5. )
  6. // Handler 业务逻辑处理接口
  7. // 当客户端连接建立时,会调用该接口的Handle方法
  8. // 当客户端连接断开时,会调用该接口的Close方法
  9. type Handler interface {
  10. Handle(ctx context.Context, conn net.Conn)
  11. Close() error
  12. }