From 54b57a0207add84986a4b6bd4890ae73bced0c96 Mon Sep 17 00:00:00 2001 From: Vasyl Gello Date: Mon, 15 Jul 2024 15:42:37 +0300 Subject: [PATCH] Try net.UDPCOnn Signed-off-by: Vasyl Gello --- cmd/yggstack/main.go | 2 +- src/netstack/netstack.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/yggstack/main.go b/cmd/yggstack/main.go index ffd5a20..5aeacb8 100644 --- a/cmd/yggstack/main.go +++ b/cmd/yggstack/main.go @@ -396,7 +396,7 @@ func main() { go types.ReverseProxyUDP(mtu, &udpListenConn, &remoteUdpAddr, &udpFwdConn) } - _, err := udpFwdConn.Write(udpBuffer[:bytesRead]) + _, err = udpFwdConn.Write(udpBuffer[:bytesRead]) if err != nil { logger.Debugf("Cannot write from yggdrasil to udp listener: %q", err) continue diff --git a/src/netstack/netstack.go b/src/netstack/netstack.go index 42693f7..d74c2f9 100644 --- a/src/netstack/netstack.go +++ b/src/netstack/netstack.go @@ -91,7 +91,7 @@ func (s *YggdrasilNetstack) DialTCP(addr *net.TCPAddr) (net.Conn, error) { return gonet.DialTCP(s.stack, fa, pn) } -func (s *YggdrasilNetstack) DialUDP(addr *net.UDPAddr) (*gonet.UDPConn, error) { +func (s *YggdrasilNetstack) DialUDP(addr *net.UDPAddr) (net.UDPConn, error) { fa, pn, _ := convertToFullAddr(addr.IP, addr.Port) return gonet.DialUDP(s.stack, nil, &fa, pn) } @@ -101,7 +101,7 @@ func (s *YggdrasilNetstack) ListenTCP(addr *net.TCPAddr) (net.Listener, error) { return gonet.ListenTCP(s.stack, fa, pn) } -func (s *YggdrasilNetstack) ListenUDP(addr *net.UDPAddr) (*gonet.UDPConn, error) { +func (s *YggdrasilNetstack) ListenUDP(addr *net.UDPAddr) (net.UDPConn, error) { fa, pn, _ := convertToFullAddr(addr.IP, addr.Port) return gonet.DialUDP(s.stack, &fa, nil, pn) }