2021-11-03 19:54:04 -06:00
|
|
|
package udp
|
|
|
|
|
|
|
|
import (
|
2023-06-14 09:48:52 -06:00
|
|
|
"github.com/slackhq/nebula/config"
|
2021-11-03 19:54:04 -06:00
|
|
|
"github.com/slackhq/nebula/firewall"
|
|
|
|
"github.com/slackhq/nebula/header"
|
|
|
|
)
|
|
|
|
|
|
|
|
const MTU = 9001
|
|
|
|
|
|
|
|
type EncReader func(
|
|
|
|
addr *Addr,
|
|
|
|
out []byte,
|
|
|
|
packet []byte,
|
|
|
|
header *header.H,
|
|
|
|
fwPacket *firewall.Packet,
|
|
|
|
lhh LightHouseHandlerFunc,
|
|
|
|
nb []byte,
|
|
|
|
q int,
|
|
|
|
localCache firewall.ConntrackCache,
|
|
|
|
)
|
2023-06-14 09:48:52 -06:00
|
|
|
|
|
|
|
type Conn interface {
|
|
|
|
Rebind() error
|
|
|
|
LocalAddr() (*Addr, error)
|
|
|
|
ListenOut(r EncReader, lhf LightHouseHandlerFunc, cache *firewall.ConntrackCacheTicker, q int)
|
|
|
|
WriteTo(b []byte, addr *Addr) error
|
|
|
|
ReloadConfig(c *config.C)
|
2023-07-10 11:43:48 -06:00
|
|
|
Close() error
|
2023-06-14 09:48:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type NoopConn struct{}
|
|
|
|
|
|
|
|
func (NoopConn) Rebind() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (NoopConn) LocalAddr() (*Addr, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
func (NoopConn) ListenOut(_ EncReader, _ LightHouseHandlerFunc, _ *firewall.ConntrackCacheTicker, _ int) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
func (NoopConn) WriteTo(_ []byte, _ *Addr) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (NoopConn) ReloadConfig(_ *config.C) {
|
|
|
|
return
|
|
|
|
}
|
2023-07-10 11:43:48 -06:00
|
|
|
func (NoopConn) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|