AdguardTeam / AdguardTeam/dnsproxy

[feat] mark host ipv6 empty

Offen
#517 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
3.3k
Forks
343
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

# feat

mark host ipv6 empty

## background

https://gitlab.archlinux.org/archlinux/infrastructure/-/work_items/858

There is scenario that ipv4 works, but ipv6 not work.

## problem

This could be workarouond by

- adding unreachable ipv6 above reachable ipv4

```hosts
::1 archive.archlinux.org

49.12.124.107 archive.archlinux.org
2a01:4f8:242:5614::2 archive.archlinux.org
```

```console
$ curl -vfsSL https://archive.archlinux.org
...
* IPv6: ::1, 2a01:4f8:242:5614::2
* IPv4: 49.12.124.107
...
```

But this is not perfect.

`curl` will

- try unreachable `::1` port 443 first

- wait failure

- then try reachable ipv4 port 443

For better performance, first two steps should always avoid.

Would be nice to mark host ipv6 empty.

So, `curl` will directly try reachable ipv4 port 443

```console
$ curl -vfsSL https://archive.archlinux.org
...
* IPv6: (none)
* IPv4: 49.12.124.107
```

## workaround

adding unreachable ipv6 above reachable ipv4

```bash
dnsproxy \
--config-path /path/to/custom/config \
--hosts-file-enabled \
--hosts-files /path/to/custom/hosts
```

`/path/to/custom/hosts`

```hosts
::1 archive.archlinux.org

49.12.124.107 archive.archlinux.org
2a01:4f8:242:5614::2 archive.archlinux.org
```

On system prefer ipv6, curl will

- try ipv6 `::1`, ipv6 failed as expected
- try ipv4 `49.12.124.107`, ipv4 ok as expected

```console
$ curl -vfsSL https://archive.archlinux.org
* Host archive.archlinux.org:443 was resolved.
* IPv6: ::1, 2a01:4f8:242:5614::2
* IPv4: 49.12.124.107
* Trying [::1]:443...
* connect to ::1 port 443 from ::1 port 52220 failed: Connection refused
* Trying 49.12.124.107:443...
* Trying [2a01:4f8:242:5614::2]:443...
...
* Established connection to archive.archlinux.org (49.12.124.107 port 443) from ...
...
```

## suggest

mark host ipv6 empty

```bash
dnsproxy \
--config-path /path/to/custom/config
```

`/path/to/custom/config`

```yaml
hosts-file-enabled: true
hosts-files: /path/to/custom/hosts
hosts-empty:
ipv6:
- archive.archlinux.org
```

`/path/to/custom/hosts`

```hosts
49.12.124.107 archive.archlinux.org
2a01:4f8:242:5614::2 archive.archlinux.org
```

```console
$ curl -vfsSL https://archive.archlinux.org
* Host archive.archlinux.org:443 was resolved.
* IPv6: (none)
* IPv4: 49.12.124.107
* Trying 49.12.124.107:443...
...
* Established connection to archive.archlinux.org (49.12.124.107 port 443) from ...
...
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.