SagerNet / SagerNet/sing-box

win11下set_system_proxy配置不生效

Open
#4,447 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

操作系统

Windows

系统版本

win11 25H2(26200.9168)

安装类型

sing-box for Windows 图形客户端程序

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

1.14.0-rc.1

版本

描述

入站配置了"set_system_proxy": true,但是系统默认不会修改变更系统代理。导致无法使用vpn。
我试过使用管理员启动也不行,启动之后日志无报错。不知道是否是和安装路径有关。

重现方式

安装路径:
D:\Application\Tools\VPN For GFW\sing-box\sing-box for windows
D:\Application\Tools\VPN For GFW\sing-box\sing-box-daemon
D:\Application\Tools\VPN For GFW\sing-box\sing-box-ProgramData
配置文件如下:
{
// 配置DNS模块
"dns": {
// 定义一组 DNS 服务器
"servers": [
// 国外DNS:谷歌DoT加密DNS,解析境外域名,查询流量走代理出站
{
"type": "tls",
"tag": "google",
"server": "8.8.8.8",
"server_port": 853,
"detour": "proxy"
},
// 定义本地的DNS
{
"type": "udp",
"tag": "local",
"server": "223.5.5.5",
"server_port": 53
}
],
// 定义DNS分流匹配规则:域名命中规则集,就分配给对应DNS服务器解析
"rules": [
// 命中谷歌域名列表 → 使用google DNS解析
{
"rule_set": "geosite-google",
"server": "google"
},
// 命中全部海外域名列表 → 使用google DNS解析
{
"rule_set": "geosite-geolocation-!cn",
"server": "google"
},
// 命中中国大陆域名列表 → 使用国内阿里DNS解析
{
"rule_set": "geosite-geolocation-cn",
"server": "local"
}
],
// 定义默认DNS服务器的标签 → 使用国内阿里DNS解析
"final": "local"
},
// 配置入站的信息
"inbounds": [
// 配置入站协议为mixed是一个 socks4, socks4a, socks5 和 http 服务器
{
"type": "mixed",
"tag": "mixed-in",
"listen": "127.0.0.1",
"listen_port": 7890,
// 启动时自动设置系统代理,停止时自动清理。
"set_system_proxy": true
}
],
// 定义的共享 HTTP 客户端的标签,给sing‑box内核内部的网络请求用,常见下载远程rule‑set规则文件
"http_clients": [
{
"tag": "download",
"detour": "proxy"
}
],
// 配置出站的信息
"outbounds": [
// 配置出站协议为VLESS
{
"type": "vless",
"tag": "VLESS",
"server": "x.x.x.x",
"server_port": x,
"uuid": "xxxxx",
//"network": "", //默认所有,所以不用写这个参数
"tls": {
"enabled": true,
// 这里就是忽略证书的开关
"insecure": true
},
"packet_encoding": "xudp"
},
// 配置出站协议为HY2
{
"type": "hysteria2",
"tag": "HY2",
"server": "x.x.x.x",
"server_port": x,
"up_mbps": 1000,
"down_mbps": 1000,
"password": "xxxxxxxxx",
//"network": "", //默认所有,所以不用写这个参数
"tls": {
"enabled": true,
// 这里就是忽略证书的开关
"insecure": true
}
},
// 配置一个兜底的出站协议,直接发送请求
{
"type": "direct",
"tag": "direct-out"
},
// 配置一个统一的出站组方便灵活切换
{
"type": "selector",
"tag": "proxy",
"outbounds": [
"VLESS",
"HY2",
"direct-out"
],
"default": "VLESS"
}
],
// 这里配置路由,它决定每一条网络流量,该走哪一条出站(代理 / 直连 / 拦截)
"route": {
// 一组路由流量匹配规则:从上往下依次匹配,命中第一条就停止
"rules": [
// 启用sniff对连接执行协议嗅探
{
"action": "sniff"
},
// 启用劫持DNS请求至sing-box DNS 模块
{
"action": "hijack-dns",
"protocol": "dns"
},
// 命中广告域名 → 直接拦截拒绝访问
{
"rule_set": "geosite-category-ads-all",
"action": "reject"
},
// 命中国内域名或者国内IP → 流量走直连出站 direct-out
{
"rule_set": [
"geosite-geolocation-cn",
"geoip-cn"
],
"outbound": "direct-out"
},
// 命中海外域名 → 流量走代理出站 TTHK-VLESS
{
"rule_set": [
"geosite-geolocation-!cn",
"geosite-google"
],
"outbound": "proxy"
}
],
// 远程规则集下载定义库,供下方rules路由规则引用
"rule_set": [
// 匹配google体系的相关域名
{
"type": "remote",
"tag": "geosite-google",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-google.srs",
//"update_interval": "2h0m0s", // 默认1小时
"http_client": "download"
},
// !cn = not china,海外域名库,匹配境外网站域名
{
"type": "remote",
"tag": "geosite-geolocation-!cn",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-!cn.srs",
//"update_interval": "2h0m0s", // 默认1小时
"http_client": "download"
},
// 中国大陆域名库,匹配绝大多数国内网站域名
{
"type": "remote",
"tag": "geosite-geolocation-cn",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs",
//"update_interval": "2h0m0s", // 默认1小时
"http_client": "download"
},
// 中国大陆IP库,匹配属于国内的IP地址
{
"type": "remote",
"tag": "geoip-cn",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
//"update_interval": "2h0m0s", // 默认1小时
"http_client": "download"
},
// 广告域名黑名单库,配合block出站拦截广告
{
"type": "remote",
"tag": "geosite-category-ads-all",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs",
//"update_interval": "2h0m0s", // 默认1小时
"http_client": "download"
}
],
// 兜底:所有未命中规则的流量默认本地直连(白名单模式)
"final": "direct-out",
"default_domain_resolver": "local",
// 自动检测本机网卡,OpenWrt / Windows / macOS都建议开启true
"auto_detect_interface": true
},
// 实验性功能区块,里面功能不保证完全稳定
"experimental": {
// 开启缓存文件,退出sing‑box后把缓存持久化保存到本地磁盘
"cache_file": {
"enabled": true,
"store_fakeip": true,
"store_dns": true
},
// Clash外部控制API的默认分流模式,Enhanced=增强模式(sing‑box独有,比Rule模式更强大)
"clash_api": {
"default_mode": "Enhanced"
}
}
}

日志
INFO[0000] network: updated default interface WLAN, index 11
INFO[0000] network: updated network environment: gateway 192.168.x.x, gateway_mac x.x.x.x
INFO[0000] inbound/mixed[mixed-in]: tcp server started at 0.0.0.0:65530
INFO[0000] sing-box started (0.53s)
支持我们
完整性要求
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior on Windows 11 25H2 with the sing-box for Windows graphical client 1.14.0-rc.1 and the mixed inbound using set_system_proxy. Compare the system proxy state with the startup log, then identify the Windows client entry point responsible for applying that setting; done means the system proxy changes as configured without requiring administrator startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
desktop-dev, networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.