yonggekkk / sing-box_hysteria2_tuic_argo_reality

sing-box精装桶一键脚本【Hysteria2、Tuic5、Vless-reality、Vmess-ws/argo】:支持alpine系统,多端口跳跃、自签/acme双证书切换、Argo固定临时双隧道(可共存);附singbox电脑网页客户端下载
https://ygkkk.blogspot.com/2023/10/sing-box-yg.html
1.9k stars 525 forks source link

分流规则请教 #66

Closed sunlewuyou closed 5 months ago

sunlewuyou commented 5 months ago

在勇哥的脚本分流规则中手动添加包名分流,试了好几个版本的sing-box也都没有成功分流,不知道分流规则有什么问题,按照域名分流的话倒是没问题,就是包名分流不成功,还请勇哥帮忙瞅瞅,谢谢!

{
  "log": {
    "disabled": false,
    "level": "info",
    "timestamp": true
  },
  "experimental": {
    "clash_api": {
      "external_controller": "127.0.0.1:9090",
      "external_ui": "ui",
      "external_ui_download_url": "",
      "external_ui_download_detour": "",
      "secret": "",
      "default_mode": "Rule"
       },
      "cache_file": {
            "enabled": true,
            "path": "cache.db",
            "store_fakeip": true
        }
    },
    "dns": {
        "servers": [
            {
                "tag": "proxydns",
                "address": "tls://8.8.8.8/dns-query",
                "detour": "select"
            },
            {
                "tag": "localdns",
                "address": "h3://223.5.5.5/dns-query",
                "detour": "direct"
            },
            {
                "address": "rcode://refused",
                "tag": "block"
            },
            {
                "tag": "dns_fakeip",
                "address": "fakeip"
            }
        ],
        "rules": [
            {
                "outbound": "any",
                "server": "localdns",
                "disable_cache": true
            },
            {
                "clash_mode": "Global",
                "server": "proxydns"
            },
            {
                "clash_mode": "Direct",
                "server": "localdns"
            },
            {
                "rule_set": "geosite-cn",
                "server": "localdns"
            },
            {
                 "rule_set": "geosite-geolocation-!cn",
                 "server": "proxydns"
            },
             {
                "rule_set": "geosite-geolocation-!cn",         
                "query_type": [
                    "A",
                    "AAAA"
                ],
                "server": "dns_fakeip"
            }
          ],
           "fakeip": {
           "enabled": true,
           "inet4_range": "198.18.0.0/15",
           "inet6_range": "fc00::/18"
         },
          "independent_cache": true,
          "final": "proxydns"
        },
      "inbounds": [
    {
      "type": "tun",
      "inet4_address": "172.19.0.1/30",
      "inet6_address": "fd00::1/126",
      "auto_route": true,
      "strict_route": true,
      "sniff": true,
      "sniff_override_destination": true,
      "domain_strategy": "prefer_ipv4"
    }
  ],
  "outbounds": [
    {
      "tag": "select",
      "type": "selector",
      "default": "auto",
      "outbounds": [
        "auto",
        "vless-centos7",
        "vmess-centos7",
        "hy2-centos7",
        "tuic5-centos7"
      ]
    },
    {
      "type": "vless",
      "tag": "vless-centos7",
      "server": "36.158.21.52",
      "server_port": ,
      "uuid": "",
      "packet_encoding": "xudp",
      "flow": "xtls-rprx-vision",
      "tls": {
        "enabled": true,
        "server_name": "",
        "utls": {
          "enabled": true,
          "fingerprint": "chrome"
        },
      "reality": {
          "enabled": true,
          "public_key": "Ev_dSUwHqM4fDFewtg9btEidFL09CB18nzkxROiexgE",
          "short_id": ""
        }
      }
    },
{
            "server": "",
            "server_port": ,
            "tag": "vmess-centos7",
            "tls": {
                "enabled": ,
                "server_name": "",
                "insecure": false,
                "utls": {
                    "enabled": true,
                    "fingerprint": "chrome"
                }
            },
            "packet_encoding": "packetaddr",
            "transport": {
                "headers": {
                    "Host": [
                        ""
                    ]
                },
                "path": "",
                "type": "ws"
            },
            "type": "vmess",
            "security": "auto",
            "uuid": ""
        },

    {
        "type": "hysteria2",
        "tag": "hy2-centos7",
        "server": "",
        "server_port": ,
        "password": "",
        "tls": {
            "enabled": true,
            "server_name": "",
            "insecure": false,
            "alpn": [
                "h3"
            ]
        }
    },
        {
            "type":"tuic",
            "tag": "tuic5-centos7",
            "server": "",
            "server_port": ,
            "uuid": "",
            "password": "",
            "congestion_control": "bbr",
            "udp_relay_mode": "native",
            "udp_over_stream": false,
            "zero_rtt_handshake": false,
            "heartbeat": "10s",
            "tls":{
                "enabled": true,
                "server_name": "",
                "insecure": false,
                "alpn": [
                    "h3"
                ]
            }
        },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "tag": "block",
      "type": "block"
    },
    {
      "tag": "dns-out",
      "type": "dns"
    },
    {
      "tag": "auto",
      "type": "urltest",
      "outbounds": [
        "vless-centos7",
        "vmess-centos7",
        "hy2-centos7",
        "tuic5-centos7"
      ],
      "url": "https://www.gstatic.com/generate_204",
      "interval": "1m",
      "tolerance": 50,
      "interrupt_exist_connections": false
    }
  ],
  "route": {
      "rule_set": [
            {
                "tag": "geosite-geolocation-!cn",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-!cn.srs",
                "download_detour": "select",
                "update_interval": "1d"
            },
            {
                "tag": "geosite-cn",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/geolocation-cn.srs",
                "download_detour": "select",
                "update_interval": "1d"
            },
            {
                "tag": "geoip-cn",
                "type": "remote",
                "format": "binary",
                "url": "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geoip/cn.srs",
                "download_detour": "select",
                "update_interval": "1d"
            }
        ],
    "auto_detect_interface": true,
    "final": "select",
    "rules": [
      {
        "package_name": "com.openai.chatgpt", // OpenAI ChatGPT应用包名
        "outbound": "hy2-centos7"                  // 将通过'hy2-centos7'出口转发
      },
      {
        "outbound": "dns-out",
        "protocol": "dns"
      },
      {
        "clash_mode": "Direct",
        "outbound": "direct"
      },
      {
        "clash_mode": "Global",
        "outbound": "select"
      },
      {
        "rule_set": "geoip-cn",
        "outbound": "direct"
      },
      {
        "rule_set": "geosite-cn",
        "outbound": "direct"
      },
      {
      "ip_is_private": true,
      "outbound": "direct"
      },
      {
        "rule_set": "geosite-geolocation-!cn",
        "outbound": "select"
      }
    ]
  },
    "ntp": {
    "enabled": true,
    "server": "time.apple.com",
    "server_port": 123,
    "interval": "30m",
    "detour": "direct"
  }
}

这条规则死活不成功: { "package_name": "com.openai.chatgpt", // OpenAI ChatGPT应用包名 "outbound": "hy2-centos7" // 将通过'hy2-centos7'出口转发 }

yonggekkk commented 5 months ago

应用包名分流看下官方文档吧。在这方面我没需求,没了解过

sunlewuyou commented 5 months ago

应用包名分流看下官方文档吧。在这方面我没需求,没了解过

好的,谢谢,可能是bug吧,目前是采用规则集的形式达到目的的:

{
                "rule_set": "OpenAI",
                "outbound": "hy2-centos7"
 },

甬哥以后会往脚本里多添加一点规则集吧。谢谢回复!

yonggekkk commented 5 months ago

应用包名分流看下官方文档吧。在这方面我没需求,没了解过

好的,谢谢,可能是bug吧,目前是采用规则集的形式达到目的的:

{
                "rule_set": "OpenAI",
                "outbound": "hy2-centos7"
 },

甬哥以后会往脚本里多添加一点规则集吧。谢谢回复!

这类交互比较累,再说吧。。

sunlewuyou commented 5 months ago

应用包名分流看下官方文档吧。在这方面我没需求,没了解过

好的,谢谢,可能是bug吧,目前是采用规则集的形式达到目的的:

{
                "rule_set": "OpenAI",
                "outbound": "hy2-centos7"
 },

甬哥以后会往脚本里多添加一点规则集吧。谢谢回复!

这类交互比较累,再说吧。。

好的!