xmdhs / clash2singbox

将 clash.meta 格式的配置文件或链接转换为 sing-box 格式
https://clash2sfa.xmdhs.com
MIT License
710 stars 93 forks source link

转换后无法直接使用 #22

Closed CussiusKon closed 5 months ago

CussiusKon commented 5 months ago

无法直接使用,导入sing-box提示invalid message

xmdhs commented 5 months ago

就不能发个截图以及转换后的配置文件吗

CussiusKon commented 5 months ago

就不能发个截图以及转换后的配置文件吗

{
"dns": {
"fakeip": {
"enabled": true,
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
},
"independent_cache": true,
"rules": [
{
"outbound": [
"any"
],
"server": "local"
},
{
"disable_cache": true,
"geosite": [
"category-ads-all"
],
"server": "block"
},
{
"query_type": [
"A",
"AAAA"
],
"rewrite_ttl": 1,
"server": "fakeip"
},
{
"clash_mode": "global",
"server": "remote"
},
{
"clash_mode": "direct",
"server": "local"
},
{
"geosite": "cn",
"server": "local"
}
],
"servers": [
{
"address": "8.8.8.8",
"detour": "select",
"tag": "remote"
},
{
"address": "223.5.5.5",
"detour": "direct",
"tag": "local"
},
{
"address": "rcode://success",
"tag": "block"
},
{
"address": "fakeip",
"tag": "fakeip"
}
],
"strategy": "prefer_ipv4"
},
"experimental": {
"clash_api": {
"external_controller": "127.0.0.1:9090",
"secret": "xxx"
}
},
"inbounds": [
{
"auto_route": false,
"domain_strategy": "prefer_ipv4",
"endpoint_independent_nat": true,
"inet4_address": "172.19.0.1/30",
"inet6_address": "2001:0470:f9da:fdfa::1/64",
"mtu": 9000,
"strict_route": true,
"type": "tun"
},
{
"domain_strategy": "prefer_ipv4",
"listen": "127.0.0.1",
"listen_port": 2333,
"tag": "socks-in",
"type": "socks",
"users": []
},
{
"domain_strategy": "prefer_ipv4",
"listen": "127.0.0.1",
"listen_port": 2334,
"set_system_proxy": true,
"tag": "mixed-in",
"type": "mixed",
"users": []
}
],
"log": {},
"outbounds": [
{
"tag": "select",
"type": "selector",
"default": "urltest",
"outbounds": [
"urltest",
"kra-reality",
"kr-reality",
"hysteria2_us"
]
},
{
"server": "ip",
"server_port": 8443,
"tag": "kra-reality",
"tls": {
"enabled": true,
"server_name": "www.xxx.jp",
"utls": {
"enabled": true,
"fingerprint": "firefox"
},
"reality": {
"enabled": true,
"public_key": "-y4w3xAj0",
"short_id": "xx"
}
},
"type": "vless",
"uuid": "xx",
"flow": "xtls-rprx-vision",
"packet_encoding": "xudp"
},
{
"server": "ip2",
"server_port": 443,
"tag": "kr-reality",
"tls": {
"enabled": true,
"server_name": "www.xxx.jp",
"utls": {
"enabled": true,
"fingerprint": "chrome"
},
"reality": {
"enabled": true,
"public_key": "xxx-y4wx3Aj0",
"short_id": "xxx"
}
},
"type": "vless",
"uuid": "xx",
"flow": "xtls-rprx-vision",
"packet_encoding": "xudp"
},
{
"password": "xxx",
"server": "ip3",
"server_port": 8443,
"tag": "hysteria2_us",
"tls": {
"enabled": true,
"server_name": "xx.org"
},
"type": "hysteria2",
"down_mbps": 50,
"up_mbps": 20
},
{
"tag": "urltest",
"type": "urltest",
"outbounds": [
"kra-reality",
"kr-reality",
"hysteria2_us"
]
},
{
"tag": "direct",
"type": "direct"
},
{
"tag": "block",
"type": "block"
},
{
"tag": "dns-out",
"type": "dns"
}
],
"route": {
"auto_detect_interface": true,
"rules": [
{
"geosite": "category-ads-all",
"outbound": "block"
},
{
"outbound": "dns-out",
"port": 53
},
{
"clash_mode": "direct",
"outbound": "direct"
},
{
"clash_mode": "global",
"outbound": "select"
},
{
"geoip": [
"cn",
"private"
],
"outbound": "direct"
}
]
}
}

我不太懂singbox的写法,报错不说,路由规则看起来不对啊,丢了很多,下面是clash路由规则

rules:
- 'RULE-SET,person-reject,REJECT'
- 'RULE-SET,applications,DIRECT'
- 'GEOSITE,category-entertainment,SELECTED'
- 'RULE-SET,ruleset-us-domains,hysteria2_us'
- 'RULE-SET,person-domain-proxy-blackmode,SELECTED'
- 'RULE-SET,person-domain-direct-blackmode,DIRECT'
- 'RULE-SET,person-ip-direct-blackmode,DIRECT,no-resolve'
- 'RULE-SET,telegramcidr,SELECTED,no-resolve'
- 'RULE-SET,person-ip-proxy,SELECTED,no-resolve'
- 'MATCH,DIRECT'
xmdhs commented 5 months ago

给 sfa 用去用这个 https://github.com/xmdhs/clash2sfa

我这个两个转换工具都不会按照 clash 的路由规则,因为本就不是一个思路。以及这个项目的目的就是自己编写 sing-box 的路由规则,然后通过这个项目填充节点。

blacksheepaul commented 5 months ago

给通过搜索引擎来到这的人:

安卓的配置和pc的配置不一样,pc用的是json,但安卓似乎要用bpf。bpf可以通过在pc上的singbox导出取得

CussiusKon commented 5 months ago

clash2sfa

给 sfa 用去用这个 https://github.com/xmdhs/clash2sfa

我这个两个转换工具都不会按照 clash 的路由规则,因为本就不是一个思路。以及这个项目的目的就是自己编写 sing-box 的路由规则,然后通过这个项目填充节点。

除了路由规则之外,其余部分,dns、节点等,有什么问题吗

CussiusKon commented 5 months ago

给通过搜索引擎来到这的人:

安卓的配置和pc的配置不一样,pc用的是json,但安卓似乎要用bpf。bpf可以通过在pc上的singbox导出取得

哦 ,pc端和手机端配置还不一样?

blacksheepaul commented 5 months ago

@CussiusKon 我刚用 sing-box,不确定。但我确实遇到了这样的情况: 同一份配置,

xmdhs commented 5 months ago

S40704-20355692_io nekohasekai sfa

S40704-20381150_io nekohasekai sfa