对于小白来说 sing-box 配置文件怎么这么难?

1 月 10 日
 superdotcom

有没有高手帮我写一个: sing-box generate reality-keypair PrivateKey: qMCz1Bcp_jem-_FmSUWUED0y8ITupySnHI6G1iA_aXM PublicKey: 1KRphO0OcGvd6f9O0y6dTca73V6AM3sZarAi18EMZBE sing-box generate rand --hex 4 f8ed2d0e sing-box generate uuid 95d10748-3589-4ce0-9cfd-f8b3f1fde844

7879 次点击
所在节点    问与答
19 条回复
c0okies
1 月 10 日
我也觉得这个好难,每次改配置都好麻烦,于是我又回到了 shadowrocket
superdotcom
1 月 10 日
@c0okies 是的,服务端搞好了,客户端怎么搞也搞不定,ai 都问了个遍,也解决不了,关键是 shadowsocks 用不了 udp,我想用 voice 打电话
jamme
1 月 10 日
```
{
"outbounds": [
{
"tag": "test",
"type": "vless",
"server": "0.0.0.0",
"server_port": 11111,
"uuid": "95d10748-3589-4ce0-9cfd-f8b3f1fde844",
"tls": {
"enabled": true,
"server_name": "www.microsoft.com",
"insecure": false,
"reality": {
"enabled": true,
"public_key": "1KRphO0OcGvd6f9O0y6dTca73V6AM3sZarAi18EMZBE",
"short_id": "f8ed2d0e"
},
"utls": {
"enabled": true
}
},
"flow": "xtls-rprx-vision"
}
]
}
```
评论好像没办法用 markdown 格式,你自己整一下缩进吧。

如果不想看文档,可以交给 AI 。如果 ai 也懒得用的话,还有个终极方案,自己部署一个 substore 服务,然后写一下 mihomo 的配置,它可以帮你转换任意主流工具的格式。
yuyu01
1 月 10 日
还好吧,其实主要就 inbound 这部分比较难一些
MacTavish123
1 月 10 日
这类软件可以理解为:Designed specifically for airports.
ThirdFlame
1 月 10 日
瞅两眼 这个不就搞定了 https://github.com/chika0801/sing-box-examples
p4d9k
1 月 10 日
配置总变,服务端可以固定版本使用,像 iOS 这种除非提取 ipa ,不然不能控制版本。
Danswerme
1 月 10 日
“客户端怎么搞也搞不定”,讲一下具体症状,贴上脱密后的客户端配置,大家才好帮你 debug
99s
1 月 10 日
当时配置弄了好久,新的版本配置也不兼容,要重新配,不过好处是省内存,配好后都感受不到它的存在
labubu
1 月 10 日
提交 github 链接给 ai 然后再问,它会阅读代码,这样就不会有问题了
OwO233
1 月 11 日
去 github 找配置文件,或者转换。不过还是推荐用 clash 。
Hitmux
1 月 11 日
superdotcom
1 月 12 日
顶上去啊,等哪位高手解答一下
netdisco
1 月 13 日
这题我会,等我共享
cairnechen
1 月 22 日
@superdotcom 兄弟我好像遇到和你一样的问题了,和 AI 聊了会,他说是 dns 请求被直接发往 tun ip 的问题,但是我比较怀疑
cairnechen
1 月 22 日
@netdisco 大佬求帮助,我也遇到了
netdisco
1 月 29 日
@cairnechen 参考这里的配置,超出 10000 字
```json
"providers": [
{
"tag": "provider1",
"type": "remote",
"url": "此处填入订阅",
"user_agent": "sing-box/v1.12.0",
"download_detour": "direct",
"update_interval": "24h0m0s",
"health_check": {
"enabled": true,
"url": "https://www.gstatic.com/generate_204",
"interval": "10m0s",
"timeout": "3s"
}
}
],
"dns": {
"servers": [
{
"tag": "proxy_server_dns",
"type": "https",
"server": "doh.pub",
"domain_resolver": "hosts"
},
{
"tag": "direct_dns",
"type": "https",
"server": "dns.alidns.com",
"domain_resolver": "hosts"
},
{
"tag": "proxy_dns",
"type": "https",
"server": "cloudflare-dns.com",
"domain_resolver": "hosts",
"detour": "proxy"
},
{
"tag": "local",
"type": "local"
},
{
"tag": "fake-ip-dns-server",
"type": "fakeip",
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/64"
},
{
"tag": "hosts",
"type": "hosts",
"predefined": {
"dns.alidns.com": [
"223.5.5.5",
"223.6.6.6"
],
"doh.pub": [
"1.12.12.21",
"120.53.53.53"
],
"dns.google": [
"8.8.8.8",
"8.8.4.4"
],
"cloudflare-dns.com": [
"104.16.248.249",
"104.16.249.249"
]
}
}
],
"rules": [
{
"clash_mode": "Global",
"server": "proxy_dns"
},
{
"clash_mode": "Direct",
"server": "direct_dns"
},
{
"domain_suffix": [
"market.xiaomi.com"
],
"server": "direct_dns"
},
{
"domain_suffix": [
"lancache.steamcontent.com"
],
"server": "proxy_dns"
},
{
"query_type": "PTR",
"server": "local"
},
{
"query_type": [
"SVCB",
"HTTPS"
],
"action": "reject"
},
{
"query_type": [
"A",
"AAAA"
],
"server": "fake-ip-dns-server",
"rewrite_ttl": 1
},
{
"rule_set": "gfw",
"server": "proxy_dns"
}
],
"final": "direct_dns",
"independent_cache": true,
"cache_capacity": 4096
},
"route": {
"rules": [
{
"domain": [
"Mijia Cloud"
],
"domain_suffix": [
"push.apple.com"
],
"rule_set": [
"telegram_ip"
],
"invert": true,
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"udp_disable_domain_unmapping": true,
"udp_connect": true,
"action": "route-options"
},
{
"clash_mode": "Global",
"outbound": "GLOBAL"
},
{
"clash_mode": "Direct",
"outbound": "direct"
},
{
"domain": [
"abyss.cyapi.cn",
"ad.cyapi.cn",
"gather.colorfulclouds.net"
],
"action": "reject"
},
{
"domain_suffix": [
"steamserver.net"
],
"outbound": "direct"
},
{
"outbound": "tg-sg",
"ip_cidr": [
"91.108.16.0/21",
"91.108.56.0/23",
"149.154.168.0/22",
"2001:b28:f23c::/48",
"2001:b28:f23f::/48"
]
},
{
"outbound": "tg-us",
"ip_cidr": [
"91.108.12.0/22",
"149.154.172.0/22",
"2001:b28:f23d::/48"
]
},
{
"outbound": "tg-eu",
"ip_cidr": [
"5.28.192.0/18",
"91.105.192.0/23",
"91.108.4.0/22",
"91.108.8.0/22",
"91.108.56.0/22",
"95.161.64.0/20",
"109.239.140.0/24",
"149.154.160.0/21",
"185.76.151.0/24",
"2001:67c:4e8::/48",
"2a0a:f280:203::/48"
]
},
{
"network": "icmp",
"outbound": "direct"
},
{
"protocol": "quic",
"rule_set": "youtube",
"action": "reject"
},
{
"ip_is_private": true,
"outbound": "direct"
},
{
"rule_set": "private",
"outbound": "direct"
},
{
"rule_set": "ai",
"outbound": "ai"
},
{
"rule_set": [
"telegram",
"github",
"twitter",
"youtube",
"google",
"gfw"
],
"outbound": "proxy"
},
{
"rule_set": "cn",
"outbound": "direct"
},
{
"action": "resolve",
"match_only": true
},
{
"rule_set": "cn_ip",
"outbound": "direct"
}
],
"final": "proxy",
"auto_detect_interface": true,
"default_domain_resolver": "proxy_server_dns",
"default_domain_match_strategy": "prefer_fqdn",
"rule_set": [
{
"tag": "AWAvenue-Ads",
"type": "remote",
"url": "https://raw.githubusercontent.com/TG-Twilight/AWAvenue-Ads-Rule/main/Filters/AWAvenue-Ads-Rule-Singbox.json",
"download_detour": "proxy"
},
{
"tag": "private",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-private.srs",
"download_detour": "proxy"
},
{
"tag": "ai",
"type": "remote",
"url": "https://raw.githubusercontent.com/YiXuanZX/sing-box-geosite/main/rule/ai.srs",
"download_detour": "proxy"
},
{
"tag": "telegram",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-telegram.srs",
"download_detour": "proxy"
},
{
"tag": "telegram_ip",
"type": "remote",
"url": "https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/telegramip.srs",
"download_detour": "proxy"
},
{
"tag": "github",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-github.srs",
"download_detour": "proxy"
},
{
"tag": "twitter",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-twitter.srs",
"download_detour": "proxy"
},
{
"tag": "youtube",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-youtube.srs",
"download_detour": "proxy"
},
{
"tag": "google",
"type": "remote",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-google.srs",
"download_detour": "proxy"
},
{
"tag": "gfw",
"type": "remote",
"url": "https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/gfw.srs",
"download_detour": "proxy"
},
{
"tag": "cn",
"type": "remote",
"url": "https://raw.githubusercontent.com/YiXuanZX/sing-box-geosite/main/rule/cn-additional-list-clash-classical.srs",
"download_detour": "proxy"
},
{
"tag": "cn_ip",
"type": "remote",
"url": "https://github.com/DustinWin/ruleset_geodata/releases/download/sing-box-ruleset/cnip.srs",
"download_detour": "proxy"
}
]
},
```
netdisco
1 月 29 日
```json
"outbounds": [
{
"tag": "hk",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"include": "(?i)香港|hong kong"
},
{
"tag": "sg",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"include": "(?i)(新加坡|狮城|singapore)"
},
{
"tag": "jp",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"include": "(?i)日本|japan"
},
{
"tag": "us",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"include": "(?i)美国|united states"
},
{
"tag": "eu",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"include": "(?i)伦敦|英国|United Kingdom|法国|France|德国|Germany|荷兰|Netherlands"
},
{
"tag": "other",
"type": "selector",
"outbounds": [],
"use_all_providers": true,
"exclude": "(?i)回家|剩余|到期|Traffic|Expire|香港|hong kong|新加坡|狮城|singapore|日本|japan|美国|united states|伦敦|英国|United Kingdom|法国|France|德国|Germany|荷兰|Netherlands"
},
{
"tag": "proxy",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "hk"
},
{
"tag": "ai",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "us"
},
{
"tag": "tg-sg",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "sg"
},
{
"tag": "tg-us",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "us"
},
{
"tag": "tg-eu",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "eu"
},
{
"tag": "GLOBAL",
"type": "selector",
"outbounds": [
"hk",
"sg",
"jp",
"us",
"eu",
"other"
],
"default": "hk"
},
{
"tag": "direct",
"type": "direct",
"domain_resolver": "local"
}
],
"inbounds": [
{
"tag": "tun-in",
"type": "tun",
"address": [
"172.19.0.1/30",
"fdfe:dcba:9876::1/126"
],
"stack": "system",
"auto_route": true,
"auto_redirect": false,
"platform": {
"http_proxy": {
"enabled": true,
"server": "127.0.0.1",
"server_port": 7890,
"bypass_domain": [
"*zhihu.com",
"*zhimg.com",
"*jd.com",
"100ime-iat-api.xfyun.cn",
"*360buyimg.com"
]
}
}
},
{
"tag": "mixed-in",
"type": "mixed",
"listen": "127.0.0.1",
"listen_port": 7890,
"set_system_proxy": false
}
],
"log": {
"level": "warn",
"timestamp": true
},
"experimental": {
"urltest_unified_delay": true,
"cache_file": {
"enabled": true,
"store_fakeip": true,
"store_rdrc": true
},
"clash_api": {
"external_controller": "[::]:9090",
"external_ui": "ui",
"external_ui_download_url": "https://github.com/Zephyruso/zashboard/archive/refs/heads/gh-pages.zip",
"external_ui_download_detour": "proxy",
"external_ui_update_interval": "24h0m0s"
}
}
```
wnbot
3 月 25 日
刚发现一个能在线配置规则的网页,你可以试试: https://jeffthebside.github.io/OkProxyConf/

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1184470

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX