V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
superdotcom
V2EX  ›  问与答

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

  •  
  •   superdotcom · 20 天前 · 1858 次点击

    有没有高手帮我写一个: 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

    第 1 条附言  ·  19 天前
    我自己瞎折腾了二天
    "inbounds": [
    {
    "type": "socks",
    "tag": "socks-in",
    "listen": "127.0.0.1",
    "listen_port": 1080
    }
    ],
    这样子用 firefox-esr socks5 代理上网蛮好,关键是我要用 voice 打电话,CHATGPT 说要用 tun ,帮我写了一个
    "inbounds": [
    {
    "type": "tun",
    "tag": "tun-in",
    "interface_name": "singbox0",

    "address": [
    "172.19.0.1/30"
    ],

    "auto_route": true,
    "strict_route": true,

    "sniff": true,
    "sniff_override_destination": true
    }
    ],
    为什么用 tun 就所有的网络都无法连接了,救大神给个解
    18 条回复    2026-01-29 11:55:42 +08:00
    c0okies
        1
    c0okies  
       20 天前
    我也觉得这个好难,每次改配置都好麻烦,于是我又回到了 shadowrocket
    superdotcom
        2
    superdotcom  
    OP
       20 天前
    @c0okies 是的,服务端搞好了,客户端怎么搞也搞不定,ai 都问了个遍,也解决不了,关键是 shadowsocks 用不了 udp,我想用 voice 打电话
    jamme
        3
    jamme  
       20 天前
    ```
    {
    "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
        4
    yuyu01  
       20 天前 via Android
    还好吧,其实主要就 inbound 这部分比较难一些
    MacTavish123
        5
    MacTavish123  
       20 天前
    这类软件可以理解为:Designed specifically for airports.
    ThirdFlame
        6
    ThirdFlame  
       20 天前
    瞅两眼 这个不就搞定了 https://github.com/chika0801/sing-box-examples
    p4d9k
        7
    p4d9k  
       20 天前
    配置总变,服务端可以固定版本使用,像 iOS 这种除非提取 ipa ,不然不能控制版本。
    Danswerme
        8
    Danswerme  
       20 天前
    “客户端怎么搞也搞不定”,讲一下具体症状,贴上脱密后的客户端配置,大家才好帮你 debug
    99s
        9
    99s  
       20 天前
    当时配置弄了好久,新的版本配置也不兼容,要重新配,不过好处是省内存,配好后都感受不到它的存在
    labubu
        10
    labubu  
       20 天前 via Android
    提交 github 链接给 ai 然后再问,它会阅读代码,这样就不会有问题了
    OwO233
        11
    OwO233  
       20 天前
    去 github 找配置文件,或者转换。不过还是推荐用 clash 。
    superdotcom
        13
    superdotcom  
    OP
       19 天前
    顶上去啊,等哪位高手解答一下
    netdisco
        14
    netdisco  
       17 天前 via Android
    这题我会,等我共享
    cairnechen
        15
    cairnechen  
       9 天前
    @superdotcom 兄弟我好像遇到和你一样的问题了,和 AI 聊了会,他说是 dns 请求被直接发往 tun ip 的问题,但是我比较怀疑
    cairnechen
        16
    cairnechen  
       9 天前
    @netdisco 大佬求帮助,我也遇到了
    netdisco
        17
    netdisco  
       2 天前
    @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
        18
    netdisco  
       2 天前
    ```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"
    }
    }
    ```
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2347 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 09:00 · PVG 17:00 · LAX 01:00 · JFK 04:00
    ♥ Do have faith in what you're doing.