AdguardTeam / AdguardTeam/dnsproxy
[feat] mark host ipv6 empty
- Ngôn ngữ chính
- Go
- Star
- 3.3k
- Fork
- 343
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
# 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 ...
...
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.