From cc575867ab0233b2dc81908b1b25b448a4901edf Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Sat, 13 Apr 2024 13:20:21 +0200 Subject: [PATCH] fix!: override DNS manually --- go.mod | 2 +- go.sum | 4 ++-- protocol/messenger_mailserver_cycle.go | 14 ++++++++++++++ .../waku-org/go-waku/waku/v2/discv5/discover.go | 1 + .../go-waku/waku/v2/protocol/enr/localnode.go | 4 ++++ vendor/modules.txt | 2 +- 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 5183ce2b5cb..8dfb2b80b07 100644 --- a/go.mod +++ b/go.mod @@ -90,7 +90,7 @@ require ( github.com/schollz/peerdiscovery v1.7.0 github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 github.com/urfave/cli/v2 v2.24.4 - github.com/waku-org/go-waku v0.8.1-0.20240301034357-3aa391058a0b + github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe github.com/wk8/go-ordered-map/v2 v2.1.7 github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1 diff --git a/go.sum b/go.sum index bcfece0751a..2cbc125e406 100644 --- a/go.sum +++ b/go.sum @@ -2101,8 +2101,8 @@ github.com/waku-org/go-discover v0.0.0-20240129014929-85f2c00b96a3 h1:Kk0KYXZE/u github.com/waku-org/go-discover v0.0.0-20240129014929-85f2c00b96a3/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04= -github.com/waku-org/go-waku v0.8.1-0.20240301034357-3aa391058a0b h1:/as1NPzReDHPWz00dk5IWWwjL91As7gDcGieKUwq3zo= -github.com/waku-org/go-waku v0.8.1-0.20240301034357-3aa391058a0b/go.mod h1:RjTvkTrIwpoT1cM9HeQqwa2Q7t7WOkb3hpuB/zuZ6SM= +github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe h1:rJF7qKODzvWx03iaLbYyjvA62crnCaDqIN661aqCQ8c= +github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe/go.mod h1:RjTvkTrIwpoT1cM9HeQqwa2Q7t7WOkb3hpuB/zuZ6SM= github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59 h1:jisj+OCI6QydLtFq3Pyhu49wl9ytPN7oAHjMfepHDrA= github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59/go.mod h1:1PdBdPzyTaKt3VnpAHk3zj+r9dXPFOr3IHZP9nFle6E= github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b h1:KgZVhsLkxsj5gb/FfndSCQu6VYwALrCOgYI3poR95yE= diff --git a/protocol/messenger_mailserver_cycle.go b/protocol/messenger_mailserver_cycle.go index 85e100c0b0b..294a2c7463d 100644 --- a/protocol/messenger_mailserver_cycle.go +++ b/protocol/messenger_mailserver_cycle.go @@ -6,6 +6,7 @@ import ( "fmt" "math" "math/big" + "net" "runtime" "sort" "strings" @@ -219,6 +220,19 @@ type SortedMailserver struct { } func (m *Messenger) findNewMailserver() error { + // we have to override DNS manually because of https://github.com/status-im/status-mobile/issues/19581 + const bootstrapDNS = "8.8.8.8:53" + var dialer net.Dialer + net.DefaultResolver = &net.Resolver{ + PreferGo: false, + Dial: func(context context.Context, _, _ string) (net.Conn, error) { + conn, err := dialer.DialContext(context, "udp", bootstrapDNS) + if err != nil { + return nil, err + } + return conn, nil + }, + } pinnedMailserver, err := m.getPinnedMailserver() if err != nil { m.logger.Error("Could not obtain the pinned mailserver", zap.Error(err)) diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go b/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go index dd9a462ad0a..582e46d2467 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go @@ -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) diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/enr/localnode.go b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/enr/localnode.go index 08f98c3d2a4..a297d54c862 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/enr/localnode.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/enr/localnode.go @@ -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") } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2dc74f5b95a..215c0b0ebae 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1020,7 +1020,7 @@ github.com/waku-org/go-discover/discover/v5wire github.com/waku-org/go-libp2p-rendezvous github.com/waku-org/go-libp2p-rendezvous/db github.com/waku-org/go-libp2p-rendezvous/pb -# github.com/waku-org/go-waku v0.8.1-0.20240301034357-3aa391058a0b +# github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe ## explicit; go 1.19 github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/waku/persistence