matrix-org / matrix-appservice-irc

Node.js IRC bridge for Matrix
Apache License 2.0
460 stars 149 forks source link

Can't access homeserver via IPv6 #1778

Closed Salamandar closed 9 months ago

Salamandar commented 9 months ago

Hi, I'm in a bit of a weird situation. The bridge is trying to call the homeserver with its link-local IPv6:

DEBUG 00:09:07:377 [MatrixHttpClient] (REQ-1) GET http://mydomain.tld/_matrix/client/v3/directory/room/%23matrix-org-coc-bl%3Amatrix.org
ERROR 00:09:07:451 [MatrixHttpClient] (REQ-1) Error: connect EINVAL fe80::854d:5dff:c6bc:5cef:80 - Local (:::0)
    at internalConnect (node:net:1067:16)
    at defaultTriggerAsyncIdScope (node:internal/async_hooks:463:18)
    at GetAddrInfoReqWrap.emitLookup [as callback] (node:net:1324:9)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:110:8) {
  errno: -22,
  code: 'EINVAL',
  syscall: 'connect',
  address: 'fe80::854d:5dff:c6bc:5cef',
  port: 80
}

It has the same behaviour with https:// The issue is that nginx doesn't seem to listen on link-local addresses and this seems like a common issue. I can't use the direct ipv4 address, because the bridge would tell me "Expired certificate" because no domain is matched, of course.

The bridge should exclude what looks like link-local addresses (fe80:.*), to use the standard ipv6 (or, if not, ipv4) instead.

Half-Shot commented 9 months ago

This'll be a standard Node thing, we don't really direct the DNS requests to any particular flavour. The workaround should be to do a --dns-result-orderorder=ipv4first.

Salamandar commented 9 months ago

Yes, probably. It looks like it might be a system setup issue, so i'm closing it for now.