mirror of
https://github.com/yggdrasil-network/yggstack.git
synced 2025-04-27 21:55:07 +03:00
Fix UDP port forward not working with Yggdrasil client
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
parent
08f51fded2
commit
bfc106637a
1 changed files with 12 additions and 8 deletions
|
@ -465,13 +465,16 @@ func main() {
|
|||
for {
|
||||
bytesRead, remoteUdpAddr, err := udpListenConn.ReadFrom(udpBuffer)
|
||||
if err != nil {
|
||||
if bytesRead == 0 {
|
||||
continue
|
||||
}
|
||||
logger.Debugf("udp readFrom error: %v", err)
|
||||
}
|
||||
if bytesRead == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
remoteUdpAddrStr := remoteUdpAddr.String()
|
||||
|
||||
var udpSession *UDPSession = nil
|
||||
|
||||
connVal, ok := remoteUdpConnections.Load(remoteUdpAddrStr)
|
||||
|
||||
if !ok {
|
||||
|
@ -481,17 +484,18 @@ func main() {
|
|||
logger.Errorf("Failed to connect to %s: %s", mapping.Mapped, err)
|
||||
continue
|
||||
}
|
||||
udpSession := &UDPSession{
|
||||
udpSession = &UDPSession{
|
||||
conn: udpFwdConn,
|
||||
remoteAddr: remoteUdpAddr,
|
||||
}
|
||||
remoteUdpConnections.Store(remoteUdpAddrStr, udpSession)
|
||||
go types.ReverseProxyUDP(mtu, udpListenConn, remoteUdpAddr, udpFwdConn)
|
||||
}
|
||||
} else {
|
||||
udpSession, ok = connVal.(*UDPSession)
|
||||
|
||||
udpSession, ok := connVal.(*UDPSession)
|
||||
if !ok {
|
||||
continue
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
udpFwdConnPtr := udpSession.conn.(*net.UDPConn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue