mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-14 06:27:22 +00:00
fix: handle discv5 udp port 0
This will update the UDP port used in the params with whatever value is obtained from ListenUDP
This commit is contained in:
parent
3aa391058a
commit
dd81e1d469
@ -178,6 +178,7 @@ func (d *DiscoveryV5) listen(ctx context.Context) error {
|
||||
|
||||
}
|
||||
|
||||
d.params.udpPort = uint(d.udpAddr.Port)
|
||||
d.localnode.SetFallbackUDP(d.udpAddr.Port)
|
||||
|
||||
listener, err := discover.ListenV5(ctx, conn, d.localnode, d.config)
|
||||
|
@ -79,6 +79,10 @@ func WithIP(ipAddr *net.TCPAddr) ENROption {
|
||||
|
||||
func WithUDPPort(udpPort uint) ENROption {
|
||||
return func(localnode *enode.LocalNode) (err error) {
|
||||
if udpPort == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if udpPort > math.MaxUint16 {
|
||||
return errors.New("invalid udp port number")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user