chika0801 / sing-box-examples

sing-box 配置示例
https://github.com/SagerNet/sing-box
1.8k stars 298 forks source link

有没有sing-box和adguard home配合的例子 #95

Closed zengkid closed 8 months ago

zengkid commented 8 months ago

有没有sing-box和adguard home配合的例子?

chika0801 commented 8 months ago

不用adg,所以没有。

chika0801 commented 8 months ago

adg 点左下第2个图标(盾)- dns保护功能 - dns服务器 - 最下面自定义服务器,填127.0.0.1:10853

sing-box(sfa)配置

{
    "log": {
        "level": "info"
    },
    "dns": {
        "servers": [
            {
                "tag": "dns_proxy",
                "address": "https://1.1.1.1/dns-query",
                "address_resolver": "dns_resolver",
                "strategy": "ipv4_only",
                "detour": "proxy"
            },
            {
                "tag": "dns_direct",
                "address": "https://dns.alidns.com/dns-query",
                "address_resolver": "dns_resolver",
                "strategy": "prefer_ipv6",
                "detour": "direct"
            },
            {
                "tag": "dns_resolver",
                "address": "223.5.5.5",
                "detour": "direct"
            },
            {
                "tag": "dns_success",
                "address": "rcode://success"
            },
            {
                "tag": "dns_refused",
                "address": "rcode://refused"
            },
            {
                "tag": "dns_fakeip",
                "address": "fakeip"
            }
        ],
        "rules": [
            {
                "outbound": "any",
                "server": "dns_resolver"
            },
            {
                "domain_suffix": [
                    ".mcdn.bilivideo.cn",
                    ".szbdyd.com"
                ],
                "domain_regex": [
                    "cn-[a-zA-Z0-9-]+\\.bilivideo\\.com",
                    "[a-zA-Z0-9-]+-pcdn-[a-zA-Z0-9-]+\\.biliapi\\.net"
                ],
                "server": "dns_success",
                "disable_cache": true
            },
            {
                "rule_set": "geosite-geolocation-!cn",
                "query_type": [
                    "A",
                    "AAAA"
                ],
                "server": "dns_fakeip"
            },
            {
                "rule_set": "geosite-geolocation-!cn",
                "query_type": [
                    "CNAME"
                ],
                "server": "dns_proxy"
            },
            {
                "query_type": [
                    "A",
                    "AAAA",
                    "CNAME"
                ],
                "invert": true,
                "server": "dns_refused",
                "disable_cache": true
            }
        ],
        "final": "dns_direct",
        "independent_cache": true,
        "fakeip": {
            "enabled": true,
            "inet4_range": "198.18.0.0/15",
            "inet6_range": "fc00::/18"
        }
    },
    "route": {
        "rule_set": [
            {
                "tag": "geosite-geolocation-!cn",
                "type": "remote",
                "format": "binary",
                "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-!cn.srs",
                "download_detour": "proxy"
            },
            {
                "tag": "geoip-cn",
                "type": "remote",
                "format": "binary",
                "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
                "download_detour": "proxy"
            }
        ],
        "rules": [
            {
                "port": 53,
                "outbound": "dns-out"
            },
            {
                "domain_suffix": [
                    ".mcdn.bilivideo.cn",
                    ".szbdyd.com"
                ],
                "domain_regex": [
                    "cn-[a-zA-Z0-9-]+\\.bilivideo\\.com",
                    "[a-zA-Z0-9-]+-pcdn-[a-zA-Z0-9-]+\\.biliapi\\.net"
                ],
                "outbound": "block"
            },
            {
                "rule_set": "geosite-geolocation-!cn",
                "outbound": "proxy"
            },
            {
                "rule_set": "geoip-cn",
                "outbound": "direct"
            },
            {
                "ip_is_private": true,
                "outbound": "direct"
            }
        ],
        "final": "proxy",
        "auto_detect_interface": true
    },
    "inbounds": [
        {
            "type": "socks",
            "listen": "::",
            "listen_port": 10808,
            "sniff": true,
            "sniff_override_destination": false
        },
        {
            "type": "direct",
            "listen": "::",
            "listen_port": 10853,
            "network": "udp",
            "override_address": "223.5.5.5",
            "override_port": 53
        }
    ],
    "outbounds": [
        {
            "type": "vless",
            "tag": "proxy",
            // 你的出站配置
        },
        {
            "type": "direct",
            "tag": "direct"
        },
        {
            "type": "block",
            "tag": "block"
        },
        {
            "type": "dns",
            "tag": "dns-out"
        }
    ],
    "experimental": {
        "cache_file": {
            "enabled": true,
            "path": "cache.db",
            "store_fakeip": true
        }
    }
}
chika0801 commented 8 months ago

adg 右下角齿轮图标

过滤 - 网络 - 代理 - 代理服务器添加一个地址是127.0.0.1:10808类型socks5把最下面的通过socks代理udp记着勾上。

chika0801 commented 8 months ago

再点里面的通过代理运行的应用,进去后搜sing-box,取消选它。

剩下你先试,不会的带图来问

baraja commented 8 months ago

用这个配置,android上面正常,但是用在windows上面,geoip=cn走直连的规则无法命中,国内网站都走了代理是咋回事呢? 现在的问题就是喂给他域名不解析,都走到final规则上去了,比如访问https://dns.alidns.com走代理,访问https://223.5.5.5才会直连 能否指教一下windows下面该如何正确设置,不想使用tun模式。

chika0801 commented 8 months ago

windows系统我不清楚了。我没在windows上安装过adg,所以不知道adg在win上是不是也创建了tun。没经验,不能帮你。