SagerNet / SagerNet/sing-box

sing-box以windows服务方式启动时,set_system_proxy字段设置为true但无法正常设置开启windows系统代理

Open
#2,001 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

操作系统

Windows

系统版本

windows 10 64位

安装类型

sing-box 原始命令行程序

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

No response

版本
sing-box version 1.10.0-alpha.28

Environment: go1.22.5 windows/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: 3c21bd7f6bfdff0f01a523ab6a5d6734e339e6af
CGO: disabled
描述

sing-box使用类似winsw的包装器以windows服务方式启动时,set_system_proxy字段设置为true但无法正常设置开启windows系统代理。查阅源码后发现,sing-box在windows平台设置系统代理使用的应该是windows api InternetSetOptionW,根据此文档的描述,该函数不能用于服务方式设置系统代理,如果要使用服务方式启动,应使用WinHTTP中的api,此问题可能是上述原因造成的。直接在CMD终端中使用命令启动sing-box则不会出现此问题。希望sing-box能够适配以提供更好的兼容性,谢谢!

重现方式

在入站中使用以下配置,并使用windows服务方式启动sing-box

"inbounds": [
    {
        "type": "mixed",
        "tag": "mixed-in",
        "listen": "127.0.0.1",
        "listen_port": 54321,
        "set_system_proxy": true
    }
 ]
日志
无任何异常日志产生
支持我们
完整性要求
  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、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 tracing the Windows implementation of set_system_proxy and compare its InternetSetOptionW behavior with the WinHTTP APIs referenced in the report. Reproduce the provided mixed inbound configuration under a Windows service and from a command prompt; done means system proxy activation works in the service context without regressing command-line startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.