p核名称由来
p核是由PuerNya开发的sing-box,是由官方的sing-box fork发展而来,所以简称为sing-box p核或者p核,致力于为用户提供更强大和灵活的网络代理功能。地址:https://github.com/PuerNya/sing-box
下载及安装
打开https://github.com/PuerNya/sing-box/actions ,进入对应的任务进行下载,如下载安卓安装包进入Build SFA任务进行下载,下载内核进入Build Cores任务进行下载。
同步更新及功能覆盖
sing-box p核与原版保持同步更新,确保原版有的功能,p核也同样具备。此外,p核还引入了部分独特功能如代理集合、dns并发自动选择最快的dns等,个人认为超越了原版。
代理集合支持多种订阅类型
P核的代理集合功能允许用户指定UA,因此不仅支持sing-box订阅,还兼容clash及其他类型的订阅文件。同时也支持给订阅的节点添加前缀和后缀,这样有多个订阅时可以方便区分。
clash UI 支持
sing-box p核支持clash UI,为用户提供了便捷的界面操作体验,更好地管理和配置代理规则。启动后浏览器进入https://d.metacubex.one/或者
https://metacubexd.pages.dev/(第一次打开可能要添加127.0.0.1:9090)即可进入clash webui界面管理sing-box,也可以用其它第三方的clash webui界面。
文档
p核文档:sing-box/docs/configuration at building · PuerNya/sing-box · GitHub
官方文档:引言 - sing-box
配置分享
{
"log": { "disabled": false, "level": "warn", "timestamp": true },
"dns": {
"servers": [
// 不去广告,不然有些网站访问有问题
// { "tag": "dns_block", "address": "rcode://success" },
{ "tag": "dns_local", "address": [ "223.5.5.5", "119.29.29.29", "[2400:3200::1]", "[2400:3200:baba::1]", "[2402:4e00::]" ], "detour": "🎯 全球直连" },
{ "tag": "dns_proxy", "address": [ "tls://8.8.4.4", "tls://208.67.222.2" ], "client_subnet": "114.114.114.114", "detour": "🎯 全球直连" },
{ "tag": "dns_fakeip", "address": "fakeip" }
],
"rules": [
{ "outbound": "any", "server": "dns_local", "disable_cache": true },
{ "domain_suffix": [ "ghproxy.com", "jsdelivr.net", "guangbomi.com", "oaifree.com" ], "server": "dns_local" },
{ "clash_mode": "Direct", "query_type": [ "A", "AAAA" ], "server": "dns_local" },
{ "clash_mode": "Global", "query_type": [ "A", "AAAA" ], "server": "dns_proxy" },
// { "rule_set": [ "ads" ], "server": "dns_block", "disable_cache": true, "rewrite_ttl": 0 },
{ "rule_set": [ "proxy" ], "query_type": [ "A", "AAAA" ],"rewrite_ttl": 1, "server": "dns_fakeip"},
{ "rule_set": [ "cn" ], "query_type": [ "A", "AAAA" ], "server": "dns_local" },
{ "fallback_rules": [ { "rule_set": [ "cnip" ], "server": "dns_local" }, { "match_all": true, "server": "dns_fakeip", "rewrite_ttl": 1 } ], "server": "dns_proxy" }
],
"final": "dns_proxy",
"strategy": "prefer_ipv4",
"independent_cache": true,
"lazy_cache": true,
"reverse_mapping": true,
"mapping_override": true,
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/15", "inet6_range": "fc00::/18", "exclude_rule": { "rule_set": [ "fakeip-filter", "private" ] } }
},
"inbounds": [
{ "tag": "tun-in", "type": "tun", "interface_name": "tun0", "stack": "mixed", "inet4_address": [ "172.19.0.1/30" ], "inet6_address": [ "fdfe:dcba:9876::1/126" ], "auto_route": true, "strict_route": true, "sniff": true, "platform": { "http_proxy": { "enabled": false, "server": "127.0.0.1", "server_port": 1082 } } }, { "type": "mixed", "listen": "127.0.0.1", "listen_port": 1082, "sniff": true, "users": [] }
],
"outbounds": [
{ "tag": "🔰 节点选择", "type": "selector", "outbounds": [ "♻️ 自动选择", "🇭🇰 香港自动", "🇨🇳 台湾自动", "🇯🇵 日本自动", "🇰🇷 韩国自动", "🇸🇬 狮城自动", "🇺🇸 美国自动", "🌀 手动切换", "🎯 全球直连" ] },
{ "tag": "🌀 手动切换", "type": "selector", "use_all_providers": true, "includes": [ "🇭🇰|香港|HK|HONGKONG|HongKong|🇨🇳|台湾|TW|TAIWAN|Taiwan|🇯🇵|日本|JP|JAPAN|Japan|🇸🇬|新加坡|SG|SINGAPORE|Singapore|🇺🇸|美国|US|UNITED STATES|United States" ] },
{ "tag": "♻️ 自动选择", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "outbounds": [ "🇭🇰 香港自动", "🇨🇳 台湾自动", "🇯🇵 日本自动", "🇰🇷 韩国自动", "🇸🇬 狮城自动", "🇺🇸 美国自动" ] },
{ "tag": "🤖 人工智能", "type": "selector", "outbounds": [ "🇭🇰 香港自动", "🇨🇳 台湾自动", "🇯🇵 日本自动", "🇰🇷 韩国自动", "🇸🇬 狮城自动", "🇺🇸 美国自动" ] },
{ "tag": "🎮 游戏服务", "type": "selector", "outbounds": [ "🎯 全球直连", "🔰 节点选择" ] },
{ "tag": "🪟 微软服务", "type": "selector", "outbounds": [ "🎯 全球直连", "🔰 节点选择" ] },
{ "tag": "🇬 谷歌服务", "type": "selector", "outbounds": [ "🎯 全球直连", "🔰 节点选择" ] },
{ "tag": "🍎 苹果服务", "type": "selector", "outbounds": [ "🎯 全球直连", "🔰 节点选择" ] },
{ "tag": "🇨🇳 直连域名", "type": "selector", "outbounds": [ "🎯 全球直连" ] },
{ "tag": "🇨🇳 直连 IP", "type": "selector", "outbounds": [ "🎯 全球直连" ] },
{ "tag": "🪜 代理域名", "type": "selector", "outbounds": [ "🔰 节点选择", "🎯 全球直连" ] },
{ "tag": "📲 电报消息", "type": "selector", "outbounds": [ "🔰 节点选择" ] },
{ "tag": "🖥️ 直连软件", "type": "selector", "outbounds": [ "🎯 全球直连" ] },
{ "tag": "🔒 私有网络", "type": "selector", "outbounds": [ "🎯 全球直连" ] },
{ "tag": "🛑 广告拦截", "type": "selector", "outbounds": [ "REJECT" ] },
{ "tag": "🎯 全球直连", "type": "selector", "outbounds": [ "DIRECT" ] },
{ "tag": "REJECT", "type": "block" },
{ "tag": "DIRECT", "type": "direct" },
{ "tag": "GLOBAL", "type": "selector", "outbounds": [ "DIRECT", "REJECT", "🇭🇰 香港自动", "🇨🇳 台湾自动", "🇯🇵 日本自动", "🇰🇷 韩国自动", "🇸🇬 狮城自动", "🇺🇸 美国自动" ] },
{ "tag": "dns-out", "type": "dns" },
{ "tag": "🐟 漏网之鱼", "type": "selector", "outbounds": [ "🔰 节点选择", "🎯 全球直连" ] },
{ "tag": "🇭🇰 香港自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇭🇰|香港|HK|HONGKONG|HongKong" ] },
{ "tag": "🇨🇳 台湾自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇨🇳|台湾|TW|TAIWAN|Taiwan" ] },
{ "tag": "🇯🇵 日本自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇯🇵|日本|JP|JAPAN|Japan" ] },
{ "tag": "🇰🇷 韩国自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇰🇷|韩国|KR|KOREA|Korea" ] },
{ "tag": "🇸🇬 狮城自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇸🇬|新加坡|SG|SINGAPORE|Singapore" ] },
{ "tag": "🇺🇸 美国自动", "type": "urltest", "url": "http://www.google-analytics.com/generate_204", "tolerance": 50, "use_all_providers": true, "includes": [ "🇺🇸|美国|US|UNITED STATES|United States" ] }
// 单个节点放这里,注意上一行加逗号
],
// 下面是放订阅链接,如果只用到第一个,请删除2和3
"outbound_providers": [
{
"tag": "🛫 1",
"type": "remote",
"download_url": "https://1.com",
"path": "./1.yaml",
"download_interval": "24h",
"download_ua": "clash.meta",
"includes": [],
"healthcheck_url": "http://www.google-analytics.com/generate_204",
"healthcheck_interval": "10m"
},
{
"tag": "🛫 2",
"type": "remote",
// "download_detour": "🌀 手动切换",
"download_url": "https://2.com",
"path": "./2.yaml",
"download_interval": "24h",
"download_ua": "clash.meta",
"includes": [],
"healthcheck_url": "http://www.google-analytics.com/generate_204",
"healthcheck_interval": "10m"
},
{
"tag": "🛫 3",
"type": "remote",
// "download_detour": "🌀 手动切换",
"download_url": "https://3.com",
"path": "./3.yaml",
"download_interval": "24h",
"download_ua": "clash.meta",
"includes": [],
"healthcheck_url": "http://www.google-analytics.com/generate_204",
"healthcheck_interval": "10m"
}
],
"route": {
"rules": [
{ "protocol": [ "dns" ], "outbound": "dns-out" },
{ "domain_suffix": [ "linux.do", "ajay.app", "returnyoutubedislikeapi.com" ], "outbound": "🪜 代理域名" },
{ "domain_suffix": [ "oaifree.com", "guangbomi.com", "bootcss.com" ], "outbound": "🇨🇳 直连域名" },
{ "protocol": [ "quic" ], "outbound": "REJECT" },
{ "clash_mode": "Direct", "outbound": "DIRECT" },
{ "clash_mode": "Global", "outbound": "GLOBAL" },
// { "rule_set": [ "ads" ], "outbound": "🛑 广告拦截" },
{ "rule_set": [ "applications" ], "outbound": "🖥️ 直连软件" },
{ "rule_set": [ "private" ], "outbound": "🔒 私有网络" },
{ "rule_set": [ "microsoft-cn" ], "outbound": "🪟 微软服务" },
{ "rule_set": [ "apple-cn" ], "outbound": "🍎 苹果服务" },
{ "rule_set": [ "google-cn" ], "outbound": "🇬 谷歌服务" },
{ "rule_set": [ "games-cn" ], "outbound": "🎮 游戏服务" },
{ "rule_set": [ "ai" ], "outbound": "🤖 人工智能" },
{ "rule_set": [ "proxy" ], "outbound": "🪜 代理域名" },
{ "rule_set": [ "cn" ], "outbound": "🇨🇳 直连域名" },
{ "rule_set": [ "telegramip" ], "outbound": "📲 电报消息", "skip_resolve": true },
{ "rule_set": [ "privateip" ], "outbound": "🔒 私有网络", "skip_resolve": true },
{ "rule_set": [ "cnip" ], "outbound": "🇨🇳 直连 IP" }
],
"rule_set": [
{
"tag": "fakeip-filter",
"type": "remote",
"format": "binary",
"path": "./fakeip-filter.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/fakeip-filter.srs"
},
// {
// "tag": "ads",
// "type": "remote",
// "format": "binary",
// "path": "./ads.srs",
// "url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/ads.srs"
// },
{
"tag": "applications",
"type": "remote",
"format": "binary",
"path": "./applications.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/applications.srs"
},
{
"tag": "private",
"type": "remote",
"format": "binary",
"path": "./private.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/private.srs"
},
{
"tag": "microsoft-cn",
"type": "remote",
"format": "binary",
"path": "./microsoft-cn.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/microsoft-cn.srs"
},
{
"tag": "apple-cn",
"type": "remote",
"format": "binary",
"path": "./apple-cn.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/apple-cn.srs"
},
{
"tag": "google-cn",
"type": "remote",
"format": "binary",
"path": "./google-cn.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/google-cn.srs"
},
{
"tag": "games-cn",
"type": "remote",
"format": "binary",
"path": "./games-cn.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/games-cn.srs"
},
{
"tag": "ai",
"type": "remote",
"format": "binary",
"path": "./openai.srs",
"url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/OpenAI.srs"
},
{
"tag": "proxy",
"type": "remote",
"format": "binary",
"path": "./proxy.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/proxy.srs"
},
{
"tag": "cn",
"type": "remote",
"format": "binary",
"path": "./cn.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cn.srs"
},
{
"tag": "telegramip",
"type": "remote",
"format": "binary",
"path": "./telegramip.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/telegramip.srs"
},
{
"tag": "privateip",
"type": "remote",
"format": "binary",
"path": "./privateip.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/privateip.srs"
},
{
"tag": "cnip",
"type": "remote",
"format": "binary",
"path": "./cnip.srs",
"url": "https://fastly.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cnip.srs"
}
],
"final": "🐟 漏网之鱼",
"auto_detect_interface": true,
"override_android_vpn": true,
"concurrent_dial": true
},
"experimental": {
"cache_file": { "enabled": true },
"clash_api": {
"external_controller": "127.0.0.1:9090",
"secret": "",
"default_mode": "Rule"
}
}
}
参考
DustinWin - GitHub - DustinWin/dustinwin.github.io: Clash 和 sing-box 教程合集——安装、配置、自定义规则、DNS 分流
不良林 - 【瑞士军刀】放弃fakeip,拥抱realip,最强网络代理工具sing-box新手指南,从此不知DNS泄漏/DNS污染为何物,软路由插件homeproxy,奈飞DNS解锁、sniff流量嗅探覆写解析 - 科学上网 技术分享
米开朗基杨 - sing-box 基础教程:sing-box 的配置方法和使用教程 · 云原生实验室