MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / ReuseUDPPort

Function ReuseUDPPort

pkg/shared/network.go:60–66  ·  view source on GitHub ↗

ReuseUDPPort creates a new UDP connection on the same local address

(localAddr *net.UDPAddr)

Source from the content-addressed store, hash-verified

58
59// ReuseUDPPort creates a new UDP connection on the same local address
60func ReuseUDPPort(localAddr *net.UDPAddr) (*net.UDPConn, error) {
61 conn, err := net.ListenUDP("udp", localAddr)
62 if err != nil {
63 return nil, fmt.Errorf("failed to reuse UDP port %d: %w", localAddr.Port, err)
64 }
65 return conn, nil
66}
67
68// CloseUDPSocketGracefully closes a UDP socket with a small delay to ensure port release
69func CloseUDPSocketGracefully(conn *net.UDPConn) {

Callers 1

startQUICClientFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected