Giter VIP home page Giter VIP logo

clash2sfa's Introduction

clash2sfa

用于将 Clash.Meta 格式的订阅链接转换为 sing-box 格式,可用于安卓版本的 SFA,ios 版本未测试。

部署

环境变量 port 控制程序运行所在的端口,若未设置默认开放在 8080 端口。

docker

docker volume create clash2sfa    
docker run -d -p 8080:8080 -v clash2sfa:/server/db ghcr.io/xmdhs/clash2sfa

使用

启动后使用浏览器访问 http://ip:port

SFA remote 中填入链接,可以通过 https://yacd.metacubex.one/ 切换节点和全局/分流模式等。

demo https://clash2sfa-xmdhs.koyeb.app/ (因为转换格式需要把订阅链接发送到服务器并保存在数据库中,且数据库会不定时删除,建议自己部署。不过若使用参数保存在链接中则不会储存到数据库中,也不会因为数据库删除导致配置信息丢失。)

配置文件模板

对配置文件模板中大多数修改都将被保留,在模板中的 outbounds 中增加节点也会被保留。

可转换的协议

https://github.com/xmdhs/clash2singbox#%E6%94%AF%E6%8C%81%E5%8D%8F%E8%AE%AE

命令行版本

https://github.com/xmdhs/clash2singbox

clash2sfa's People

Contributors

xmdhs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

clash2sfa's Issues

hy2节点转换失败

浏览器单独下载订阅配置,查看里包含hy2节点。使用同一链接转换后新的配置内不存在h2节点
原节点结构:
alpn:
- h3
name: ""
password:
port:
server:
skip-cert-verify: true
sni:
type: hysteria2
udp: true

docker内容的更新

docker内容的更新是自动的吗,还是需要一些特别的操作,需要用tun的代理模式吗?

建议增加一下订阅超时时间

机场提供的订阅服务多数使用CF的CDN服务,但是请求只能来自**IP,其他国家/地区无法访问订阅。然后感觉设置的超时时间太短,在宿主机上使用curl等工具也是能够获取到订阅,只是等待时间较长。

建议

大佬能不能在分流中加上 disney 和 netflix 啊
我看 sing-box 文档 rule 默认的好像还不行。
好像要用增强版的。
netflix 和 disney能正则筛选 ip 就太棒了建议用Selector 不然跳 ip 的话影响观看体验
谢谢大佬

[功能建议] 使用自定义 urltest / selector 时,能否完全由用户自定义?

首先非常感谢作者的项目!

我是想完全自定义 配置文件模板 和 urltest / selector,但是转化器会自动加上下面两种 outbounds。我在想能不能在用户使用自定义 urltest / selector 时,不自动加上这些 outbounds?或者是有个选项,让用户自行选择是否加入这些 outbounds。

{
  "default": "urltest",
  "outbounds": ["XXX"],
  "tag": "select",
  "type": "selector"
}

{
  "outbounds": ["XXX"],
  "tag": "urltest",
  "type": "urltest"
}

[BUG] 个别字段转换后大小写没有正确区分

clash2sfa-test.json

自己修改的模板

"outbounds": [
    {
      "type": "direct",
      "tag": "Direct"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    },
    {
      "type": "block",
      "tag": "Block"
    }
]

经转换后

outbounds": [
        {
            "tag": "direct",
            "type": "direct"
        },
        {
            "tag": "block",
            "type": "block"
        },
        {
            "tag": "dns-out",
            "type": "dns"
        }
]

规则

转换过来后,包名规则的顺序颠倒了: {
"outbound": "ytm",
"package_name": [
"com.google.android.apps.youtube.music",
"app.revanced.android.apps.youtube.music"
]
},

一个大胆的想法

我试过本地docker安装的转换工具使用作者你提供的1.80的模版直链,发现不能转换提示错误,后来全局开启tun就行了,我在想能不能把模版下载到本地,再通过一些软件的本地映射实现呢?

能否不新加而是替换同 tag 的 selector

没有打开禁用默认生成的 urltest 和 selector 且模版存在

    {
      "type": "selector",
      "tag": "select",
      "outbounds": [
        "exclude: (Traffic Reset|Expire Date|GB |直连|回国)"
      ]
    },

但转出来就是同时存在两个 tag 为 select 的 selector,这样就会无法启动

    "outbounds": [
        {
            "tag": "select",
            "type": "selector",
            "default": "urltest",
            "outbounds": [
                "urltest",
                "a",
                "b"
            ]
        },
        {
            "tag": "urltest",
            "type": "urltest",
            "outbounds": [
                "a",
                "b"
            ]
        },
        {
            "outbounds": [
                "a",
                "b"
            ],
            "tag": "select",
            "type": "selector"
        },

虽然直接禁止生成默认可以避免但是还是会有用同一个模版但有些订阅需要 urltest 的

GetSub: convert2sing: clash2sing: vless: Flow 不支持的类型

配置文件报错
GetSub: convert2sing: clash2sing: vless: Flow 不支持的类型

Clash文件格式
proxies:
- name: demo
server: demo.com
port: 10001
type: vless
uuid: xxx-xxx-xxx-xxx-xxxx
flow: none
udp: true
tls: true
network: tcp
ws-opts:
path: ""
headers:
Host: ""
rule-providers:
xxxxx

服务端是xray1.7.5,流控是none,vision二选一

某些clash规则配置,并未全部体现在sing-box的配置中

以下是clash配置文件里一段规则,貌似无法在转换后的sing-box配置文件里体现

# Local Area Network
- DOMAIN-KEYWORD,announce,DIRECT
- DOMAIN-KEYWORD,torrent,DIRECT
- DOMAIN-KEYWORD,tracker,DIRECT
- DOMAIN-SUFFIX,smtp,DIRECT
- DOMAIN-SUFFIX,local,DIRECT
- IP-CIDR,192.168.0.0/16,DIRECT
- IP-CIDR,10.0.0.0/8,DIRECT
- IP-CIDR,172.16.0.0/12,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- IP-CIDR,100.64.0.0/10,DIRECT

如果这段规则没有的话,我就无法在内网中跟其他设备直连

Nekobox

作者,你做的的这个东西很适合和Nekobox合作呢

自定义预制组件属性

希望给Direct更多的属性

[https://sing-box.sagernet.org/configuration/outbound/direct/]

希望只是检测有无type:block,dns,direct,而不是替换为默认值

Error decode config: outbound options: vmess transport options: json: unknown field "host"

此前使用並未發生問題,今次sing-box自動更新後發生錯誤。
使用demo網站:
https://clash2sfa-xmdhs.koyeb.app
轉換後,添加sing-box訂閱地址報錯信息如下:
image
sing-box發生錯誤的版本為:
image
但使用sub-web-modify專案:
https://github.com/youshandefeiyang/sub-web-modify
轉換後的訂閱地址可以正常使用。
image
因此推測是sing-box更新後,排除是sing-box的問題,而是本專案需要進行一定的更新。

vless

不支持的类型:vless:flow

疑似tuic协议转换问题

转换带有tuic节点的链接,能正常生成,然后导入sing-box则直接提示
(packet-tunnel) error: create service: create service: parse outbound[12]: TLS required

在已有 dns-out tag 的情况下重复且被错误添加到 selector 里

template:

  "outbounds": [
    {
      "type": "selector",
      "tag": "proxy",
      "outbounds": [
        "exclude: (Traffic Reset|Expire Date|GB |直连|回国)"
      ]
    },
    {
      "type": "selector",
      "tag": "paypal us",
      "outbounds": [
        "include: (United States|US)",
        "proxy"
      ]
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],

output:

        },
        {
            "tag": "direct",
            "type": "direct"
        },
        {
            "tag": "block",
            "type": "block"
        },
        {
            "tag": "dns-out",
            "type": "dns"
        },
        {
            "outbounds": [
                "1111",
                "222",
                "dns-out"
            ],
            "tag": "proxy",
            "type": "selector"
        },
        {
            "outbounds": [
                "proxy"
            ],
            "tag": "paypal us",
            "type": "selector"
        },
        {
            "tag": "dns-out",
            "type": "dns"
        }
    ],

最终无法启动

SCR-20240411-bwqs

配置模板文件使用分流写法报akeConfig: convert2sing: getExtTag: invalid character ':' after object key:value pair

应该是我的配置写错了。但不知道该怎么写。目的是为了不同网站走不同节点。
{
"log": {},
"dns": {
"servers": [
{
"tag": "remote",
"address": "tcp://1.1.1.1",
"detour": "select"
},
{
"tag": "local",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
},
{
"address": "rcode://success",
"tag": "block"
}
],
"rules": [
{
"outbound": [
"any"
],
"server": "local"
},
{
"disable_cache": true,
"geosite": [
"category-ads-all"
],
"server": "block"
},
{
"clash_mode": "global",
"server": "remote"
},
{
"clash_mode": "direct",
"server": "local"
},
{
"geosite": "cn",
"server": "local"
}
],
"strategy": "prefer_ipv4"
},
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"inet6_address": "2001:0470:f9da:fdfa::1/64",
"sniff": true,
"sniff_override_destination": true,
"domain_strategy": "prefer_ipv4",
"stack": "mixed",
"strict_route": true,
"mtu": 9000,
"endpoint_independent_nat": true,
"auto_route": true
},
{
"type": "socks",
"tag": "socks-in",
"listen": "127.0.0.1",
"sniff": true,
"sniff_override_destination": true,
"domain_strategy": "prefer_ipv4",
"listen_port": 2333,
"users": []
},
{
"type": "mixed",
"tag": "mixed-in",
"sniff": true,
"sniff_override_destination": true,
"domain_strategy": "prefer_ipv4",
"listen": "127.0.0.1",
"listen_port": 2334,
"users": []
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
},
{
"tag":" Google",
"type":"selector",
"outbounds":[
"direct",
"select"
]
"filter":[
{"action":"include","keywords":["🇹🇼","TW","tw","**","🇸🇬","SG","sg","新加坡","狮","🇯🇵","jp","JP","日本","🇺🇸","us","US","美国"}
]
}

],
"route": {
    "rules": [
        {
            "geosite": "category-ads-all",
            "outbound": "block"
        },
        {
            "protocol": "dns",
            "outbound": "dns-out"
        },

        {
            "clash_mode": "direct",
            "outbound": "direct"
        },
        {
            "clash_mode": "global",
            "outbound": "select"
        },
        {
            "geoip": [
                "cn",
                "private"
            ],
            "outbound": "direct"
        },
        {
            "geosite": "cn",
            "outbound": "direct"
        },

{
"geoip":"google",
"geosite":["google"],
"outbound":" Google"
},
],
"auto_detect_interface": true
},
"experimental": {
"clash_api": {
"external_controller": "127.0.0.1:9091",
"store_selected": true,
"secret": ""
}
}
}

配置建议

大佬,我用默认配置模板发现机场部分节点明明解锁 netflix 但是却只能看自制剧
后来在电报群里请教发现要在
1.inbounds里把"domain_strategy": "ipv4_only",去掉

2.在 "dns": {
"servers": [
{
"tag": "remote",
"address": "https:1.1.1.1/dns-query",
"detour": "select"
},
{
"tag": "local",
"address": "https:223.5.5.5/dns-query",
"Detour": "direct"
}
],
"rules" means: [
{
"clash_mode": "global",
加上 "ip_version": 4,
"server": "remote"
},
这样节点就正常了
还有一件小事就是大佬能不能顺手加上在模版上加上 clash api fakeip 相关配置啊,听说这样网能快点。我看 1.3.0 支持了。馋的慌(主要是我还不太会写🤪🤣)

bug?

大佬纯reality的机场转换导入到sfi中提示
image
安卓端也是
我的机场链接

https://sub.shenmijichang.com/api/v1/client/subscribe?token=2132ecf9daf41c3f91ece54324161f05

添加tag的逻辑似乎不太对

我添加了一个美国手动的tag,目的是为了一开始就可以选择这个tag内过滤出的美国节点,但是好像自动添加了默认select、urltest的tag,然后导致添加美国手动的tag从逻辑上讲没啥用啊,除非手搓配置,还是说我哪里没设置对
Screenshot_20231116-235351~2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.