Git Product home page Git Product logo

subconverter's Introduction

subconverter

Utility to convert between various proxy subscription formats.

Build Status GitHub tag (latest SemVer) GitHub release GitHub license

Docker README

中文文档

Supported Types

Type As Source As Target Target Name
Clash clash
ClashR clashr
Quantumult quan
Quantumult X quanx
Loon loon
SS (SIP002) ss
SS Android sssub
SSD ssd
SSR ssr
Surfboard surfboard
Surge 2 surge&ver=2
Surge 3 surge&ver=3
Surge 4 surge&ver=4
V2Ray v2ray
Telegram-liked HTTP/Socks 5 links × Only as source

Notice:

  1. Shadowrocket users should use ss, ssr or v2ray as target.

  2. You can add &remark= to Telegram-liked HTTP/Socks 5 links to set a remark for this node. For example:


Quick Usage

Using default groups and rulesets configuration directly, without changing any settings

Access Interface

http://127.0.0.1:25500/sub?target=%TARGET%&url=%URL%&config=%CONFIG%

Description

Argument Required Example Description
target Yes clash Target subscription type. Acquire from Target Name in Supported Types.
url Yes https%3A%2F%2Fwww.xxx.com Subscription to convert. Supports URLs and file paths. Process with URLEncode first.
config No https%3A%2F%2Fwww.xxx.com External configuration file path. Supports URLs and file paths. Process with URLEncode first. More examples can be found in this repository.

If you need to merge two or more subscription, you should join them with '|' before the URLEncode process.

Example:

You have 2 subscriptions and you want to merge them and generate a Clash subscription:
1. https://dler.cloud/subscribe/ABCDE?clash=vmess
2. https://rich.cloud/subscribe/ABCDE?clash=vmess

First use '|' to separate 2 subscriptions:
https://dler.cloud/subscribe/ABCDE?clash=vmess|https://rich.cloud/subscribe/ABCDE?clash=vmess

Then process it with URLEncode to get %URL%:
https%3A%2F%2Fdler.cloud%2Fsubscribe%2FABCDE%3Fclash%3Dvmess%7Chttps%3A%2F%2Frich.cloud%2Fsubscribe%2FABCDE%3Fclash%3Dvmess

Then fill %TARGET% and %URL% in Access Interface with actual values:
http://127.0.0.1:25500/sub?target=clash&url=https%3A%2F%2Fdler.cloud%2Fsubscribe%2FABCDE%3Fclash%3Dvmess%7Chttps%3A%2F%2Frich.cloud%2Fsubscribe%2FABCDE%3Fclash%3Dvmess

Finally subscribe this link in Clash and you are done!

Advanced Usage

Please refer to 中文文档.

Auto Upload

Upload Gist automatically

Add a Personal Access Token into gistconf.ini in the root directory, then add &upload=true to the local subscription link, then when you access this link, the program will automatically update the content to Gist repository.

Example:

[common]
;uncomment the following line and enter your token to enable upload function
token = xxxxxxxxxxxxxxxxxxxxxxxx(Your Personal Access Token)

subconverter's People

Contributors

artoria2e5 avatar at404bot avatar aylz10 avatar cubercsl avatar enximi avatar flosacca avatar howard20181 avatar hynor avatar kenxx avatar leileichui avatar masaiki avatar mdx-tom avatar missuo avatar qinyuhang avatar redenvelopes avatar reizhi avatar rhettor avatar ruyenet avatar summonhim avatar taurusxin avatar tindy2013 avatar tttpob avatar wqwxxxihhjjejesssooennc avatar xiami2012 avatar xiaoxinw avatar xiocode avatar xyenon avatar xylyxyrr avatar zhongfly avatar zmaplex 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  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

subconverter's Issues

能否在输出时对含特殊字符的 value 增加引号?

如题,pyyaml 等库在 Ordered Dict 类型 (key: value)中,如果 value 含冒号就会报错,如部分机场的节点名、ssr 类型代理的 protocolparam 参数等。因此为了提高兼容性,希望作者可以对含有特殊符号的 value 加上引号,以便和其他工具配合使用。

Feature Request: 对于Shadowsocks转换类型,应该添加如下几种选项

Feature Request: 对于Shadowsocks转换类型,应该添加如下几种选项:
1.base64编码
2.非base64编码
3.json格式的配置文件方式

第二种可以通过剪贴板导入进Shadowsocks Android应用程序,第三种可以通过“从文件替换”导入进Shadowsocks Android应用程序。

以及main.cpp中判断target可以从if换成switch。

clash转换缺少混淆参数

clashr用了没问题,clash貌似不能识别混淆。转的订阅是ssd,带有混淆参数,但转之后的clash配置里没有。

Android Termux上无法获取node

用浏览器打开显示:The following link doesn't contain any valid node info.
命令行输出:Fetching node data from url.

而默认配置,相同命令,相同环境下,用电脑跑win64就能用。安卓arm64和armhf均报相同错误。

红米note5 安卓9 miui11 termux最新版(里面软件包也是最新的)。
已测试releases的0.3和0.27都不行

update:发现暂时解决办法,安装proot包,执行termux-chroot在chroot环境里执行就好了。怀疑是termux的环境不标准之类的,请作者加入个检测机制或者提示使用termux-chroot

clash转clash会丢失ss的obfs

转换前:
- {"name":"ss","type":"ss","server":"a.com","port":1234,"cipher":"aes-128-gcm","password":"1234","plugin":"obfs","plugin-opts":{"mode":"http","host":"docs.microsoft.com"}}

转换后:
- {type: ss, cipher: aes-128-gcm, password: 1234, name: ss, server: a.com, port: 1234}

[建议]增加Surge的SSID Group的支持

虽然我不太确定功能上是不是支持,但subconverter似乎不支持SSID Group的输出,对吗?
我尝试用了很多办法也没办法加上最终的输出文件上加上一行SSID Group的配置,包括修改perf.ini或者修改surge.conf的基础规则模版.

因为家里的路由环境已经配置好了,所以常用ssid group。而且surge的SSID功能推出的非常早,包括surge mac 2.0 也是支持的。

参考:https://manual.nssurge.com/policy/group.html

我当前使用的subconverter版本是0.3.0,环境是Windows2016和Windows10 1909.
非常感谢您项目。

dns配置

你好,请问可否在Clash(R)的配置文件中添加有关DNS的设置?

custom_proxy_group 的逻辑问题

大佬,在 custom_proxy_group 字段可以通过 正则匹配到对应的节点,但如果当前节点里不包含正则筛选的节点时就只会返回 direct ,感觉这样的返回没有意义啊,是否考虑改为未匹配到时就不显示该策略组?
主要是当前所有的订阅都使用同一个 pref.ini ,所以 某些订阅能匹配到,但有些订阅根本没有这个关键词,语言可能表述不清楚,举例说明好了:


订阅1:美国1 美国2 香港1 香港2
订阅2:美国1 美国2 日本1 日本2
perf.ini 内
custom_proxy_group = 🇭🇰 香港`select`香港
custom_proxy_group = 🇯🇵 日本`select`日本
custom_proxy_group = 🇺🇸 美国`select`美国

显然此时 订阅1 的 🇯🇵 日本 策略组 和 订阅2 的 🇭🇰 香港 策略组只有 DIRECT
感觉就有点多余,反而可能导致界面冗长,因为本质上这个策略组是没有起到作用的。

但如果去掉的话需要注意到一个可能存在的bug:
custom_proxy_group = 节点选择`select`[]🇭🇰 香港`[]🇯🇵 日本`[]🇺🇸 美国
可能会因为排除掉无效策略组而出现问题。

[建议] 增加港、台媒体分组

现在港台媒体默认走的是国外媒体分组 但是港台很多媒体 例如:TVB 动画疯 之类的都是需要本地原生IP才能收看的 。如果能多一个香港分组 就能把TVB 等一些本地媒体划分到原生线路去了。

对 surge_base.conf 文件中空格的处理问题

原来的 [Scrip]:

http-request https?:\/\/.*\.iqiyi\.com\/.*authcookie= script-path=https://raw.githubusercontent.com/NobyDa/Script/master/Surge/iQIYI-DailyBonus/iQIYI_GetCookie.js

过api后:

http-request https?:\/\/.*\.iqiyi\.com\/.*authcookie=script-path=https://raw.githubusercontent.com/NobyDa/Script/master/Surge/iQIYI-DailyBonus/iQIYI_GetCookie.js

你会发现authcookie=背后的空格不见了,这会导致surge报错

api_mode=false, 且同时有多个请求时, 更新 ruleset 时出现 Segmentation fault

api_mode=false, 且同时有多个请求时, 更新 ruleset 时出现 Segmentation fault

环境: Debian 9 x86_64

handle_cmd:    GET
handle_uri:    /sub?target=clash&url=
Reading preference settings...
Read preference settings completed.
Updating ruleset url 'https://raw.githubusercontent.com/ConnersHua/Profiles/master/Surge/Ruleset/Unbreak.list' with group 'DIRECT'.
Updating ruleset url 'https://raw.githubusercontent.com/ConnersHua/Profiles/master/Surge/Ruleset/Advertising.list' with group '🚫 广告劫持'.
handle_cmd:    GET
handle_uri:    /sub?target=clash&url=
Reading preference settings...
Read preference settings completed.
Updating ruleset url 'https://raw.githubusercontent.com/ConnersHua/Profiles/master/Surge/Ruleset/Unbreak.list' with group 'DIRECT'.
Segmentation fault

api_mode=truemax_concurrent_threads=1 时没有问题。

在更新节点或规则时通过代理

因为手头有些订阅链接在通过 http://127.0.0.1:25500/clash?url=%url% 更新获取时速度很感人,所以想请问下是否能在 pref.ini 中设定例如 http_proxy=socks5://127.0.0.1:1080 这样的字段实现远端节点或规则时使用已有代理呢?

linux 下无法从 url 获取节点信息,无法上传至 Gist

url 问题:

handle_cmd:    GET
handle_uri:    /sub?target=clash
Reading preference settings...
Read preference settings completed.
Fetching node data from url 'https://xxx.com'.
2019/12/14 Sat 18:29:45.684989 [DEBUG] Received Link.
2019/12/14 Sat 18:29:45.685098 [DEBUG] Downloading subscription data...
Killed

Gist 问题:

...
Generate target: Clash
Gist id provided. Modifying gist...
Killed

forcerule.yml 中有冲突规则

forcerule.yml 中,office365.com 添加了两个一个是 Proxy,一个是 Direct。

  • DOMAIN-SUFFIX,office365.com,Proxy
  • DOMAIN-SUFFIX,office365.com,DIRECT

生成的规则中,结果应该是以第二个为准的

优化建议:去重

建议1:
我导入了自定义的规则,

surge_ruleset=🔰 节点选择,rules/ACL4SSR/Clash/ProxyLite.list
surge_ruleset=🎯 全球直连,rules/ACL4SSR/Clash/ChinaDomain.list
surge_ruleset=🎯 全球直连,rules/ACL4SSR/Clash/ChinaIp.list

但是如果,与默认的规则重复的话,不会进行去重。
比如我对生成的规则进行搜索 “DOMAIN-SUFFIX,qq.com,🎯 全球直连”,会出现3次一样的。
希望加一个去重功能。

建议2:
如果我同时导入了

  - DOMAIN,livew.l.qq.com,🎯 全球直连
  - DOMAIN,vd.l.qq.com,🎯 全球直连
  - DOMAIN-SUFFIX,qq.com,🎯 全球直连

那么最后一条,应该包含前面2条,可以尝试把剩下的2条去掉

谢谢你的贡献。

我的规则:

clash_rule_base=rules/ACL4SSR/Clash/General_dns.yml
surge_ruleset=🔰 节点选择,rules/ACL4SSR/Clash/ProxyLite.list
surge_ruleset=🎯 全球直连,rules/ACL4SSR/Clash/ChinaDomain.list
surge_ruleset=🎯 全球直连,rules/ACL4SSR/Clash/ChinaIp.list

https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash

Could you let External Configuration File support exclude_remarks or include_remarks?

In pref.ini, there are some lines that not supported in External Configuration File:

;Exclude nodes which remarks match the following patterns. Supports regular expression.
exclude_remarks=(到期|剩余流量|时间|官网|产品)
;exclude_remarks=(other rule)

;Only include nodes which remarks match the following patterns. Supports regular expression.
;include_remarks=V3.*港

It is seems that all possible customization settings has been shown in this file:
https://github.com/tindy2013/subconverter/blob/master/base/config/example_external_config.ini However, it is not include the lines mentioned above.

Although we can use include or exclude Argument in the link, I think it is not convenience. If this can be supported in External Configuration File, it may be better than before.

Thank you for your great work.

在Windows Server2016上出现SSL错误导致规则不完整

规则是默认配置里包括的ConnersHua的Telegram.list,输出目标是surge2和surge4,在Windows10 1909上配置好反复测试是正常的。在Windows2016上经常就会出现配置规则少了的情况,打开debug模式,发现报错如下:

Updating ruleset url 'https://raw.githubusercontent.com/ConnersHua/Profiles/master/Surge/Ruleset/Telegram.list' with group '���报信息'.
*   Trying 151.101.0.133:443...
* TCP_NODELAY set
* Connected to raw.githubusercontent.com (151.101.0.133) port 443 (#0)
* ALPN, offering http/1.1
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443
* Closing connection 0
Warning: No data was fetched from this link. Skipping...

顺带一提:如果输出为surge3,surge4的外置规则列表,最终输出为规则的只有一行:
RULE-SET,https://raw.githubusercontent.com/ConnersHua/Profiles/master/Surge/Ruleset/Telegram.list,电报信息

但程序无法下载时,就会不输出这一行规则。

我的subconverter版本是0.3.0

0.2.6版本 V2Ray/Quanx 特定配置 转换至 Quanx 出现问题

提供的 V2Ray 节点
{"v":"2","ps":"Crimson - 东京","add":"xxx.v2.xxx365.xyz","port":"443","id":"e083xxxx-xxxx-xxxx-xxxx-xxxx66218e52","aid":"8","net":"tcp","type":"none","host":"xxx.v2.xxx365.xyz","path":"","tls":"tls"}
提供的 QuanX 节点
vmess=xxx.v2.xxx365.xyz:443, method=chacha20-ietf-poly1305, password=e083xxxx-xxxx-xxxx-xxxx-xxxx66218e52,obfs-host=xxx.v2.xxx365.xyz, obfs=over-tls, fast-open=true, udp-relay=true, tag=[V2Ray] Crimson - 东京

经过 http://127.0.0.1:25500/quanx 转换后

vmess = xxx.v2.xxx365.xyz:443, method=chacha20-ietf-poly1305, password=e083xxxx-xxxx-xxxx-xxxx-xxxx66218e52, fast-open=true, udp-relay=true, tag=🇯🇵 日本 Crimson

应该是没有识别 over-tls 导致的

小白有几个问题

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.