Skip to content

Commit

Permalink
use LocalAddr for UDP associate bind address
Browse files Browse the repository at this point in the history
  • Loading branch information
ge9 committed May 25, 2024
1 parent d304516 commit 40c50a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (sf *Server) handleAssociate(ctx context.Context, writer io.Writer, request
return net.Dial(net_, addr)
}
}
bindLn, err := net.ListenUDP("udp", nil)
bindLn, err := net.ListenUDP("udp", &net.UDPAddr{IP: request.LocalAddr.(*net.TCPAddr).IP, Port: 0})
if err != nil {
if err := SendReply(writer, statute.RepServerFailure, nil); err != nil {
return fmt.Errorf("failed to send reply, %v", err)
Expand Down

0 comments on commit 40c50a9

Please sign in to comment.