UDP support
Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
This commit is contained in:
parent
8988c8f9af
commit
115d42e0f0
72 changed files with 4730 additions and 321 deletions
14
pkg/udp/handler.go
Normal file
14
pkg/udp/handler.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package udp
|
||||
|
||||
// Handler is the UDP counterpart of the usual HTTP handler.
|
||||
type Handler interface {
|
||||
ServeUDP(conn *Conn)
|
||||
}
|
||||
|
||||
// The HandlerFunc type is an adapter to allow the use of ordinary functions as handlers.
|
||||
type HandlerFunc func(conn *Conn)
|
||||
|
||||
// ServeUDP implements the Handler interface for UDP.
|
||||
func (f HandlerFunc) ServeUDP(conn *Conn) {
|
||||
f(conn)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue