Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add queryStrategy option for DNS #794

Merged
merged 1 commit into from
Mar 19, 2021
Merged

Feat: add queryStrategy option for DNS #794

merged 1 commit into from
Mar 19, 2021

Conversation

Loyalsoldier
Copy link
Contributor

@Loyalsoldier Loyalsoldier commented Mar 18, 2021

Fixes #482
Fixes #297

@Loyalsoldier
Copy link
Contributor Author

Loyalsoldier commented Mar 18, 2021

根据 #749 的建议,重新实现。复原了 V2Ray 原本的接口。

Copy link
Contributor

@xiaokangwang xiaokangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! This is what I think is the best way to make sure that unseen codes won't break because of the modification of API. Unlike gRPC API, changing interface in Go is usually breaking, which should be avoid whenever possible.

@Loyalsoldier
Copy link
Contributor Author

@yuhan6665 @CalmLong 能否帮忙测试一下这个 PR 在 Android 上使用 FakeDNS 有没有 bug?我身边没有 Android 机 😂

@rurirei
Copy link
Contributor

rurirei commented Mar 18, 2021

@Loyalsoldier seems ok.

@CalmLong
Copy link
Contributor

我还没研究过FakeDNS😓主要是用不到。。

@Loyalsoldier
Copy link
Contributor Author

@Loyalsoldier seems ok.

你测试了吗?我主要是不确定在 Android 手机上 FakeDNS 能不能跟 #696 保持一致,忽略 freedom outbound 和路由。

@Loyalsoldier Loyalsoldier merged commit e6aaa57 into v2fly:master Mar 19, 2021
@Loyalsoldier Loyalsoldier deleted the dns-queryStrategy branch March 19, 2021 07:55
@sixg0000d
Copy link
Contributor

sixg0000d commented Apr 6, 2021

这条 commit 貌似会导致 fakedns 失效,无论我是否设置 queryStrategy 及设置 "UseIP" 、 "UseIPv4" ,fakedns 都无法对匹配的域名给出解析。
在 v4.37.1 上 revert 这条 commit 并编译使用则不再复现。

配置如下
{
    "log": {
        "loglevel": "warning"
    },
    "dns": {
        "disableCache": true,
        "servers": [
            "fakedns"
        ]
    },
    "inbounds": [
        {
            "listen": "0.0.0.0",
            "port": 60080,
            "protocol": "dokodemo-door",
            "settings": {
                "address": "",
                "followRedirect": true,
                "network": "tcp,udp",
                "port": 0,
                "timeout": 0
            },
            "sniffing": {
                "destOverride": [
                    "fakedns"
                ],
                "enabled": true,
                "metadataOnly": true
            },
            "streamSettings": {
                "sockopt": {
                    "tproxy": "tproxy"
                }
            },
            "tag": "tproxy_IN"
        }
    ],
    "outbounds": [
        {
            "protocol": "vless",
            "sendThrough": "0.0.0.0",
            "settings": {
                "vnext": [
                    {
                        "address": "",
                        "port": 443,
                        "users": [
                            {
                                "encryption": "none",
                                "id": ""
                            }
                        ]
                    }
                ]
            },
            "streamSettings": {
                "network": "ws",
                "security": "tls",
                "tlsSettings": {
                    "serverName": ""
                },
                "wsSettings": {
                    "headers": {
                        "Host": ""
                    },
                    "path": ""
                }
            },
            "tag": "proxy"
        },
        {
            "protocol": "freedom",
            "tag": "DIRECT"
        },
        {
            "protocol": "blackhole",
            "tag": "BLACKHOLE"
        },
        {
            "protocol": "dns",
            "tag": "dns-out"
        }
    ],
    "routing": {
        "domainMatcher": "mph",
        "domainStrategy": "AsIs",
        "rules": [
            {
                "inboundTag": [
                    "tproxy_IN"
                ],
                "outboundTag": "dns-out",
                "port": "53",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:private"
                ],
                "outboundTag": "DIRECT",
                "type": "field"
            },
            {
                "domain": [
                    "geosite:category-ads-all"
                ],
                "outboundTag": "BLACKHOLE",
                "type": "field"
            },
            {
                "ip": [
                    "geoip:cn"
                ],
                "outboundTag": "DIRECT",
                "type": "field"
            },
            {
                "domain": [
                    "geosite:cn"
                ],
                "outboundTag": "DIRECT",
                "type": "field"
            }
        ]
    }
}

@Loyalsoldier
Copy link
Contributor Author

@sixg0000d 提 issue

@wy16W2pIilK1xgqN
Copy link

系统 win10,具有v4,v6 双地址。

系统 ping google.com 时,会显示
Ping 请求找不到主机 google.com 。请检查该名称,然后重试。
如果 ping -4 google.com,就会得到正常的fakedns 地址(192.18.0.0/15)。
非常怀疑,由于 fakedns 向客户端返回的查询时win10 系统,会默认使用 IPv6 进行访问。

v2 dns设置
{ "dns": { "servers": [ { "address": "114.114.114.114", "domains": [ "domain:translate.google.cn" ] }, { "address": "fakedns", "domains": [ "geosite:greatfire", "geosite:gfw" ] }, { "address": "8.8.8.8", "domains": [ "geosite:greatfire", "geosite:gfw" ] }, "localhost" ], "queryStrategy": "UseIPv4" } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

使用useipv4时依然会用ipv6地址进行连接 建议提供禁止ipv6 dns查询的设置
6 participants