使用 sub-store 生成 sing-box 1.12 配置

  1. 在 sub-store 中的文件管理创建文件,名称随意
  2. 来源中选择本地,填入如下1.12配置模板
{
  "log": {
    "level": "info",
    "timestamp": true
  },
  "experimental": {
    "cache_file": {
      "enabled": true,
      "store_rdrc": true
    },
    "clash_api": {
      "external_controller": "127.0.0.1:9090",
      "external_ui": "ui",
      "external_ui_download_url": "https://ghproxy.cn/github.com/MetaCubeX/metacubexd/archive/gh-pages.zip",
      "external_ui_download_detour": "direct"
    }
  },
  "dns": {
    "servers": [
      {
        "type": "https",
        "tag": "google",
        "server": "8.8.8.8",
        "detour": "select"
      },
      {
        "type": "https",
        "tag": "ali",
        "server": "223.5.5.5",
        "detour": "direct"
      }
    ],
    "rules": [
      {
        "rule_set": "geosite-cn",
        "server": "ali"
      },
      {
        "type": "logical",
        "mode": "and",
        "rules": [
          {
            "rule_set": "geosite-geolocation-!cn",
            "invert": true
          },
          {
            "rule_set": "geoip-cn"
          }
        ],
        "server": "google",
        "client_subnet": "1.0.8.0/24"
      }
    ]
  },
  "inbounds": [
    {
      "type": "tun",
      "address": [
        "172.18.0.1/30",
        "fdfe:dcba:9876::1/126"
      ],
      "auto_route": true,
      "strict_route": true,
      "platform": {
        "http_proxy": {
          "enabled": true,
          "server": "127.0.0.1",
          "server_port": 7890
        }
      }
    },
    {
      "type": "mixed",
      "listen": "::",
      "listen_port": 7890
    }
  ],
  "outbounds": [
    {
      "tag": "select",
      "type": "selector",
      "outbounds": [
        "all",
        "auto",
        "HongKong",
        "TaiWan",
        "Singapore",
        "Japan",
        "America",
        "Others",
        "direct"
      ]
    },
    {
      "tag": "all",
      "type": "selector",
      "outbounds": []
    },
    {
      "tag": "auto",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "HongKong",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "TaiWan",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "Japan",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "Singapore",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "America",
      "type": "urltest",
      "outbounds": []
    },
    {
      "tag": "Others",
      "type": "urltest",
      "outbounds": []
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "default_domain_resolver": {
      "server": "ali"
    },
    "auto_detect_interface": true,
    "rules": [
      {
        "action": "sniff"
      },
      {
        "protocol": "dns",
        "action": "hijack-dns"
      },
      {
        "protocol": "quic",
        "action": "reject"
      },
      {
        "ip_is_private": true,
        "outbound": "direct"
      },
      {
        "rule_set": [
          "geoip-cn",
          "geosite-cn"
        ],
        "outbound": "direct"
      }
    ],
    "rule_set": [
      {
        "tag": "geosite-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://ghproxy.cn/https://raw.github.com/lyc8503/sing-box-rules/rule-set-geosite/geosite-cn.srs",
        "download_detour": "direct"
      },
      {
        "tag": "geosite-geolocation-!cn",
        "type": "remote",
        "format": "binary",
        "url": "https://ghproxy.cn/https://raw.github.com/lyc8503/sing-box-rules/rule-set-geosite/geosite-geolocation-!cn.srs",
        "download_detour": "direct"
      },
      {
        "tag": "geoip-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://ghproxy.cn/https://raw.github.com/lyc8503/sing-box-rules/rule-set-geoip/geoip-cn.srs",
        "download_detour": "direct"
      }
    ]
  }
}
  1. 添加脚本操作,选择链接,填入
https://ghproxy.cn/https://raw.github.com/xream/scripts/main/surge/modules/sub-store-scripts/sing-box/template.js#&type=1&name=sub&outbound=all|auto🕳ℹ️HongKong🏷ℹ️🇭🇰|hk|港|HongKong🕳ℹ️TaiWan🏷ℹ️🇹🇼|tw|台|Taiwan🕳ℹ️Japan🏷ℹ️🇯🇵|jp|日|Japan🕳ℹ️Singapore🏷ℹ️🇸🇬|sg|新|Singapore🕳ℹ️America🏷ℹ️🇺🇸|us|美|United States🕳ℹ️Others🏷ℹ️^(?!.*(🇭🇰|hk|港|🇹🇼|tw|台|🇯🇵|jp|日|🇸🇬|sg|新|🇺🇸|us|美)).*$

’name=sub‘中的sub填改成组合订阅名称,如果是单个订阅则把参数type值改为0
4. 保存文件,这个文件的链接即为生成的 sing-box 配置

2 个赞

感谢分享

感谢分享。