Add a new protocol
Co-authored-by: Gérald Croës <gerald@containo.us>
This commit is contained in:
parent
0ca2149408
commit
4a68d29ce2
231 changed files with 6895 additions and 4395 deletions
19
tcp/handler.go
Normal file
19
tcp/handler.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package tcp
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// Handler is the TCP Handlers interface
|
||||
type Handler interface {
|
||||
ServeTCP(conn net.Conn)
|
||||
}
|
||||
|
||||
// The HandlerFunc type is an adapter to allow the use of
|
||||
// ordinary functions as handlers.
|
||||
type HandlerFunc func(conn net.Conn)
|
||||
|
||||
// ServeTCP serves tcp
|
||||
func (f HandlerFunc) ServeTCP(conn net.Conn) {
|
||||
f(conn)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue