AdguardTeam / AdguardTeam/dnsproxy

[feat] mark host ipv6 empty

オープン
#517 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
3.3k
フォーク
343
PR マージ指標
30日以内にマージされた PR はありません

説明

# 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 ...
...
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。