Skip to content

Commit

Permalink
Cast the cached UDPConn
Browse files Browse the repository at this point in the history
Signed-off-by: Vasyl Gello <[email protected]>
  • Loading branch information
basilgello committed Jul 15, 2024
1 parent 28636a5 commit 7f23c6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/yggstack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func main() {

var udpFwdConn *net.UDPConn = nil

udpFwdConn, ok := remoteUdpConnections.Load(remoteUdpAddr)
connVal, ok := remoteUdpConnections.Load(remoteUdpAddr)

if !ok {
udpFwdConn, err = net.DialUDP("udp", nil, mapping.Mapped)
Expand All @@ -379,6 +379,8 @@ func main() {
}
remoteUdpConnections.Store(remoteUdpAddr, &udpFwdConn)
go types.ReverseProxyUDP(mtu, udpListenConn, remoteUdpAddr, udpFwdConn)
} else {
udpFwdConn = connVal.(net.UDPConn)

Check failure on line 383 in cmd/yggstack/main.go

View workflow job for this annotation

GitHub Actions / Build Windows/Linux/MacOS/FreeBSD/Android

cannot use connVal.(net.UDPConn) (comma, ok expression of type net.UDPConn) as *net.UDPConn value in assignment
}

_, err = udpFwdConn.Write(udpBuffer[:bytesRead])
Expand Down

0 comments on commit 7f23c6f

Please sign in to comment.