sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

sing-box Android的分应用代理功能与广告拦截功能有冲突

Open zhea55 opened this issue 9 months ago • 11 comments

Operating system

Android

System version

Android 16

Installation type

sing-box for Android Graphical Client

If you are using a graphical client, please provide the version of the client.

1.13.0-rc.3

Version


Description

开启分应用代理功能后,国内应用里面有很多的广告、埋点请求,这些请求没有经过sing-box核心,导致广告、埋点都放行了。

Reproduction

sing-box Android有2个版本,google play版本不支持分应用代理功能。 F-Droid版本支持分应用代理功能。

这个分应用代理功能,与广告拦截功能有冲突。

我脑海里的sing-box核心有两个功能,1. dns服务器 2. 路由分发

现在的问题就是,如果我开启分应用代理功能,然后选中所有的中国应用(选中应用不经过VPN)

结果就是:国内应用打开速度很快,因为它们没有经过sing-box核心。 问题点:国内应用里面有很多的广告、埋点请求,我实际上是希望它们能到sing-box核心的。但是只要到核心,分应用代理的功能便失去了意义。

所以我现在安装的google play版本,所有应用全部经过sing-box核心。

有没有办法,既能使用分应用代理功能,又能让选中的中国应用,经过sing-box核心的dns过滤?

我所使用的dns配置

"dns": {
    "servers": [
      {
        "type": "tls",
        "server": "8.8.8.8",
        "detour": "🌐 Anonymous Multi",
        "tag": "dns-remote"
      },
      {
        "type": "udp",
        "server": "223.5.5.5",
        "tag": "dns-direct"
      },
      {
        "type": "fakeip",
        "tag": "dns-fake",
        "inet4_range": "198.18.0.0/15",
        "inet6_range": "fc00::/18"
      }
    ],
    "rules": [
      {
        "clash_mode": "Direct",
        "server": "dns-direct"
      },
      {
        "clash_mode": "Global",
        "server": "dns-remote"
      },
      {
        "rule_set": ["adblocksingbox"],    // dns里的广告拦截功能
        "action": "reject"
      },
      {
        "rule_set": ["geosite-geolocation-cn", "LocalAreaNetwork"],
        "server": "dns-direct"
      },
      {
        "type": "logical",
        "mode": "and",
        "rules": [
          {
            "rule_set": "geosite-geolocation-!cn",
            "invert": true
          },
          {
            "rule_set": "geoip-cn"
          }
        ],
        "action": "route",
        "server": "dns-direct"
      },
      {
        "disable_cache": true,
        "inbound": "tun-in",
        "query_type": ["A", "AAAA"],
        "server": "dns-fake"
      }
    ],
    "strategy": "ipv4_only",
    "independent_cache": true
  },

Logs


Supporter

Integrity requirements

  • [x] I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • [x] I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • [x] I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • [x] I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

zhea55 avatar Feb 10 '26 04:02 zhea55

既要又要还要?

jieqiu059-glitch avatar Feb 10 '26 07:02 jieqiu059-glitch

既要又要还要?

没错,既要国内应用打开速度快,还要能过滤广告、埋点请求,更要国外应用能直接开。

目前google play版本的问题在于,国内应用的请求经过了sing-box核心的dns过滤,广告和埋点过滤掉了。 但正常的请求通过了核心的route过程。如果只经过dns服务,减少后面的route过程,就完美了。

zhea55 avatar Feb 10 '26 08:02 zhea55

你见过哪个安卓代理软件在分应用里排除 APP 后,还能拦截这个已经排除的 APP 里的广告的?

jieqiu059-glitch avatar Feb 10 '26 08:02 jieqiu059-glitch

你见过哪个安卓代理软件在分应用里排除 APP 后,还能拦截这个已经排除的 APP 里的广告的?

adguard + adguardVPN

就可以实现,分应用里面选中,国内app,这些选中的逻辑是,国内app不需要翻墙功能,但是它们依然需要广告过滤。

zhea55 avatar Feb 10 '26 09:02 zhea55

那么那个 APP 内所有连接也 肯定要经过 adguardVPN 内核的,singbox 你不开分应用排除不就可以同样做到了

jieqiu059-glitch avatar Feb 10 '26 10:02 jieqiu059-glitch

你不开分应用,国内 APP 通过 sb 内核直连,其实也不会慢很多,感知几乎可以忽略

jieqiu059-glitch avatar Feb 10 '26 10:02 jieqiu059-glitch

那么那个 APP 内所有连接也 肯定要经过 adguardVPN 内核的,singbox 你不开分应用排除不就可以同样做到了

它有两个开关

  1. app是否经过adguard流量
  2. app是否经过adguard VPN的代理。

zhea55 avatar Feb 10 '26 10:02 zhea55

不开分应用也可以分流,route.rules有package_name匹配项

oppressor1761 avatar Feb 12 '26 08:02 oppressor1761

不开分应用也可以分流,route.rules有package_name匹配项

这里面涉及到性能问题。比如国内app其实只需要dns功能,只要把广告埋点reject掉,不需要走后面的route过程。无论route的逻辑怎样,所有请求全部放行,跳过route,才是最高效的。

zhea55 avatar Feb 13 '26 06:02 zhea55

跳过route?我理解只要流量进入核心就会route,否则sniff ,hijack dns都不能实现。你把规则顺序放在靠前的位置不就性能好了吗。

oppressor1761 avatar Feb 26 '26 02:02 oppressor1761

有个简单方法,设置私人DNS

liujixings avatar Jul 20 '26 00:07 liujixings