Documentation ¶
Index ¶
- func DialAddrAndIncreaseResultMap(address string, resultMap *ResultMap) error
- func DialUDPAddrWithHelloMsgAndGetReply(address *net.UDPAddr, helloMsg fmt.Stringer) (string, error)
- func GenRandomAddressIPv4(port uint16) *net.UDPAddr
- func GenRandomAddressIPv6(port uint16) *net.UDPAddr
- func ReplyWithLocalAddr(conn *net.UDPConn) error
- func ReplyWithMsg(message string) func(conn *net.UDPConn) error
- func ReplyWithReceivedMsg(conn *net.UDPConn) error
- func UnsafeStartUDPServer(ns *netns.NetNS, address string, processConn func(conn *net.UDPConn) error, ...) (<-chan struct{}, <-chan error)
- type ResultMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialUDPAddrWithHelloMsgAndGetReply ¶
func DialUDPAddrWithHelloMsgAndGetReply( address *net.UDPAddr, helloMsg fmt.Stringer, ) (string, error)
DialUDPAddrWithHelloMsgAndGetReply will open a UDP socket with provided UDP address and send there a helloMsg (fmt.Stringer), and block goroutine waiting for the message back, which will be returned as a string
func GenRandomAddressIPv4 ¶
GenRandomAddressIPv4 will generate random *net.UDPAddr (IPv4) with provided port
func GenRandomAddressIPv6 ¶
GenRandomAddressIPv6 will generate random *net.UDPAddr (IPv6) with provided port
func ReplyWithLocalAddr ¶
func ReplyWithReceivedMsg ¶
func UnsafeStartUDPServer ¶
func UnsafeStartUDPServer( ns *netns.NetNS, address string, processConn func(conn *net.UDPConn) error, callbacks ...func() error, ) (<-chan struct{}, <-chan error)
UnsafeStartUDPServer will start TCP server in provided *netns.NesNS. Every initialized udp "connection" will be processed via provided callback functions. It was named UnsafeStartUDPServer instead of StartUDPServer because you have to be very cautious and remember to not spawn new goroutines inside provided callbacks (more info in warning below)
WARNING!:
Don't spawn new goroutines inside callback functions as the goroutine inside UnsafeStartUDPServer function have exclusive access to the current network namespace, and you should assume, that any new goroutine will be placed in a different namespace