diff options
author | Robin Jarry <robin@jarry.cc> | 2024-02-03 23:58:34 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-04 10:20:56 +0100 |
commit | 2187ea163e879556cb9fdb45657c96d99db8a6f0 (patch) | |
tree | 055256d8623e33e687e7583fed8c36d1b65f3e7f /app | |
parent | 6ea74eb3045735940dea005443f5e22a35a9a1a8 (diff) | |
download | aerc-2187ea163e879556cb9fdb45657c96d99db8a6f0.tar.gz |
imap: fix connection when host only has ipv6 address
Some IMAP servers report both IPv4 and IPv6 addresses from their DNS
name:
$ host imap.gmail.com
imap.gmail.com has address 108.177.15.109
imap.gmail.com has address 108.177.15.108
imap.gmail.com has IPv6 address 2a00:1450:400c:c0a::6c
imap.gmail.com has IPv6 address 2a00:1450:400c:c0a::6d
ResolveTCPAddr actually returns the first *IPv4* address by default,
unless the address string is an explicit IPv6 address.
Directly use net.Dial which has a fast fallback mechanism. It first
tries to connect with an IPv6 address (if any) and if that fails, it
will retry with an IPv4 address (if any) before failing completely.
Link: https://cs.opensource.google/go/go/+/refs/tags/go1.21.6:src/net/ipsock.go;l=81
Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CCYVLU3AOA00I.26I5IMAF3T4CK%40dow.land%3E
Link: https://pkg.go.dev/net#Dial
Reported-by: Jonathan Dowland <jon@dow.land>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'app')
0 files changed, 0 insertions, 0 deletions