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

sing-box 1.13.13 开启游戏加速器后CPU占用高

Open Fallensakura715 opened this issue 5 months ago • 5 comments

操作系统

Windows

系统版本

11 25H2 26200.8655

安装类型

宣传使用 sing-box 的第三方图形客户端程序 (Windows)

如果您使用图形客户端程序,请提供该程序版本。

GUI.for.SingBox 1.25.3

版本

sing-box version 1.13.13

Environment: go1.25.10 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_naive_outbound,with_purego,badlinkname,tfogo_checklinkname0
Revision: 78b2e12fbdd85e6ec956647d6f79cf0bba85c6ba
CGO: disabled

描述

开游戏加速器时,有很多UDP包,CPU占用高 直连模式/规则模式占用都很高 stack 试过 mixed,gvisor,system,MTU 9000/1500

Image Image Image

规则模式去掉 process regex也占用高

Image Image Image

重现方式

打开加速器(vk/UU),加速epic商店/随便一个游戏 配置如下

{
  "log": {
    "disabled": false,
    "level": "info",
    "output": "",
    "timestamp": false
  },
  "experimental": {
    "clash_api": {
      "external_controller": "localhost:9090",
      "external_ui": "ui",
      "external_ui_download_url": "https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip",
      "external_ui_download_detour": "🟣 Default",
      "secret": "114514",
      "default_mode": "rule",
      "access_control_allow_origin": [
        "*"
      ],
      "access_control_allow_private_network": false
    },
    "cache_file": {
      "enabled": true,
      "path": "cache.db",
      "cache_id": "",
      "store_fakeip": true,
      "rdrc_timeout": "7d"
    }
  },
  "inbounds": [
    {
      "type": "tun",
      "tag": "tun-in",
      "interface_name": "sing-box",
      "address": [
        "172.18.0.1/30",
        "fdfe:dcba:9876::1/126"
      ],
      "mtu": 9000,
      "auto_route": true,
      "strict_route": false,
      "route_exclude_address": [
        "192.168.0.0/16",
        "fc00::/7"
      ],
      "endpoint_independent_nat": false,
      "stack": "mixed"
    }
  ],
//
"route": {
    "rules": [
      {
        "action": "sniff"
      },
      {
        "action": "hijack-dns",
        "protocol": "dns"
      },
      {
        "action": "route",
        "process_path_regex": [
          "^D:\\\\Programs\\\\Steam\\\\steamapps\\\\common\\\\Apex Legends\\\\.*\\.exe$",
          "^D:\\\\Programs\\\\VeryKuai\\\\.*\\.exe$"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "clash_mode": "direct",
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "clash_mode": "global",
        "outbound": "🟣 Default"
      },
      {
        "action": "route",
        "ip_is_private": true,
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "network": "icmp",
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "protocol": "bittorrent",
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Ads-All"
        ],
        "outbound": "⛔️ Ads"
      },
      {
        "action": "route",
        "rule_set": [
          "[email protected]"
        ],
        "outbound": "🟣 Default"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Microsoft@cn"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Apple@cn"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "ACL4SSR-SteamCN",
          "ACL4SSR-SteamRegionCheck"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Games-!CN@cn"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Github"
        ],
        "outbound": "🟣 Default"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Spotify"
        ],
        "outbound": "🎵 Spotify"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-AI-!CN"
        ],
        "outbound": "🪩 AI"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Game-Platforms-Download",
          "ACL4SSR-GameDownload"
        ],
        "outbound": "📩 Games Download"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Games-!CN"
        ],
        "outbound": "♣️ Games"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Telegram"
        ],
        "outbound": "💬 Telegram"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Social-Media-!CN"
        ],
        "outbound": "👥 Social Media"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Netflix"
        ],
        "outbound": "📹 Netflix"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-GoogleFCM"
        ],
        "outbound": "🔔 Google FCM"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Microsoft"
        ],
        "outbound": "Ⓜ️ Microsoft"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Apple"
        ],
        "outbound": "🍎 Apple"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-CN"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-Private"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-GFW"
        ],
        "outbound": "🟣 Default"
      },
      {
        "action": "resolve"
      },
      {
        "action": "route",
        "port": [
          25,
          110,
          143,
          465,
          587,
          993,
          995,
          135,
          137,
          138,
          139,
          445,
          593,
          4444,
          1433,
          1521,
          3306,
          5432,
          6379,
          16379,
          27017,
          27018,
          11211,
          5984,
          20,
          21,
          22,
          23,
          3389,
          5632,
          5900,
          5901,
          5902,
          5903,
          1099,
          7001,
          8161,
          8888,
          9200,
          9300,
          10000,
          10050,
          10051,
          3333,
          5555,
          7777,
          6660,
          6661,
          6662,
          6663,
          6664,
          6665,
          6666,
          6667,
          6668,
          6669,
          19,
          69,
          111,
          123,
          161,
          389,
          1900,
          5353
        ],
        "outbound": "🔘 SELECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoIP-Netflix"
        ],
        "outbound": "📹 Netflix"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoIP-Telegram"
        ],
        "outbound": "💬 Telegram"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoIP-CN"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoIP-Private"
        ],
        "outbound": "🟢 DIRECT"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoLocation-!CN"
        ],
        "outbound": "🟣 Default"
      }
    ],
    "rule_set": [
      //
    ],
    "auto_detect_interface": true,
    "final": "🟣 Default",
    "default_domain_resolver": {
      "server": "Local-DNS"
    }
  },
  "dns": {
    "servers": [
      {
        "tag": "Local-DNS-Local",
        "type": "local"
      },
      {
        "tag": "FakeIP-DNS",
        "type": "fakeip",
        "inet4_range": "198.18.0.0/15",
        "inet6_range": "fc00::/18"
      },
      {
        "tag": "Local-DNS",
        "type": "https",
        "domain_resolver": "Local-DNS-Resolver",
        "server_port": 443,
        "server": "223.5.5.5",
        "path": "/dns-query"
      },
      {
        "tag": "Local-DNS-Resolver",
        "type": "udp",
        "server_port": 53,
        "server": "223.5.5.5"
      },
      {
        "tag": "Remote-DNS",
        "type": "tls",
        "detour": "🟣 Default",
        "domain_resolver": "Remote-DNS-Resolver",
        "server_port": 853,
        "server": "8.8.8.8"
      },
      {
        "tag": "Remote-DNS-Resolver",
        "type": "udp",
        "detour": "🟣 Default",
        "server_port": 53,
        "server": "8.8.8.8"
      }
    ],
    "rules": [
      {
        "action": "route",
        "clash_mode": "direct",
        "server": "Local-DNS"
      },
      {
        "action": "route",
        "clash_mode": "global",
        "server": "FakeIP-DNS"
      },
      {
        "action": "reject",
        "rule_set": [
          "Category-Ads-All"
        ],
        "method": "drop"
      },
      {
        "action": "route",
        "domain_suffix": [
          ".ea.com",
          ".respawn.com"
        ],
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "domain_regex": "^qos-nlb-.*\\.elb\\..*\\.amazonaws\\.com$",
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "process_path_regex": "^D:\\\\Programs\\\\VeryKuai\\.*\\\\vkdns\\.exe$",
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "process_path_regex": "^D:\\\\Programs\\\\Steam\\\\.*\\.exe$",
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Games-!CN@cn",
          "Category-Game-Platforms-Download",
          "Category-Games-!CN"
        ],
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "rule_set": [
          "ACL4SSR-SteamCN",
          "ACL4SSR-GameDownload",
          "ACL4SSR-SteamRegionCheck"
        ],
        "server": "Local-DNS-Local"
      },
      {
        "action": "route",
        "rule_set": [
          "Category-Social-Media-!CN@cn",
          "GeoSite-Microsoft@cn",
          "GeoSite-Apple@cn",
          "[email protected]"
        ],
        "server": "Local-DNS"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoLocation-!CN"
        ],
        "server": "FakeIP-DNS"
      },
      {
        "action": "route",
        "rule_set": [
          "GeoSite-CN"
        ],
        "server": "Local-DNS"
      },
      {
        "action": "route",
        "query_type": [
          "A",
          "AAAA"
        ],
        "server": "FakeIP-DNS"
      }
    ],
    "disable_cache": false,
    "disable_expire": false,
    "independent_cache": true,
    "final": "Remote-DNS"
  }
}

日志

[2026-06-23 22-21-43.log](https://github.com/user-attachments/files/29255236/2026-06-23.22-21-43.log)

支持我们

完整性要求

  • [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • [x] 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • [x] 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • [x] 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。

Fallensakura715 avatar Jun 23 '26 14:06 Fallensakura715

  "route_exclude_address": [
    "192.168.0.0/16",
    "10.0.0.0/8",
    "172.16.0.0/12"
  ], 

这样写就行

hazicy avatar Jul 05 '26 02:07 hazicy

连接回环了,你需要设置绕过

Kevin-O-Hsu avatar Jul 05 '26 22:07 Kevin-O-Hsu

连接回环了,你需要设置绕过

楼上配置也这样😭

Fallensakura715 avatar Jul 06 '26 01:07 Fallensakura715

这不是UDP数据包的问题,UU持续向TUN网关地址发送icmp数据包,而TUN的第二个地址不会响应icmp数据,可以在路由规则顶部添加 { "type": "logical", "mode": "and", "rules": [ { "network": "icmp" }, { "ip_cidr": [ "172.18.0.1/30", "fdfe:dcba:9876::1/126" ] } ], "action": "reject" }

skyskihu avatar Jul 07 '26 01:07 skyskihu

这不是UDP数据包的问题,UU持续向TUN网关地址发送icmp数据包,而TUN的第二个地址不会响应icmp数据,可以在路由规则顶部添加 { "type": "logical", "mode": "and", "rules": [ { "network": "icmp" }, { "ip_cidr": [ "172.18.0.1/30", "fdfe:dcba:9876::1/126" ] } ], "action": "reject" }

已解决,谢谢佬

Fallensakura715 avatar Jul 07 '26 01:07 Fallensakura715