mirror of
https://github.com/nitezs/sub2clash.git
synced 2024-12-23 11:14:41 -05:00
fix: vless 未解析 short-id
This commit is contained in:
parent
94a320a682
commit
916670cf68
@ -2,36 +2,36 @@
|
||||
|
||||
获取 Clash/Clash.Meta 配置链接
|
||||
|
||||
| Query 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
|--------------|--------|-------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| sub | string | sub/proxy 至少有一项存在 | - | 订阅链接,可以在链接结尾加上`#名称`,来给订阅中的节点加上统一前缀(可以输入多个,用 `,` 分隔) |
|
||||
| proxy | string | sub/proxy 至少有一项存在 | - | 节点分享链接(可以输入多个,用 `,` 分隔) |
|
||||
| refresh | bool | 否 | `false` | 强制刷新配置(默认缓存 5 分钟) |
|
||||
| template | string | 否 | - | 外部模板链接或内部模板名称 |
|
||||
| ruleProvider | string | 否 | - | 格式 `[Behavior,Url,Group,Prepend,Name],[Behavior,Url,Group,Prepend,Name]...`,其中 `Group` 是该规则集使用的策略组名,`Prepend` 为 bool 类型,如果为 `true` 规则将被添加到规则列表顶部,否则添加到规则列表底部(会调整到 MATCH 规则之前) |
|
||||
| rule | string | 否 | - | 格式 `[Rule,Prepend],[Rule,Prepend]...`,其中 `Prepend` 为 bool 类型,如果为 `true` 规则将被添加到规则列表顶部,否则添加到规则列表底部(会调整到 MATCH 规则之前) |
|
||||
| autoTest | bool | 否 | `false` | 国家策略组是否自动测速 |
|
||||
| lazy | bool | 否 | `false` | 自动测速是否启用 lazy |
|
||||
| sort | string | 否 | `nameasc` | 国家策略组排序策略,可选值 `nameasc`、`namedesc`、`sizeasc`、`sizedesc` |
|
||||
| replace | string | 否 | - | 通过正则表达式重命名节点,格式 `[<ReplaceKey>,<ReplaceTo>],[<ReplaceKey>,<ReplaceTo>]...` |
|
||||
| remove | string | 否 | - | 通过正则表达式删除节点 |
|
||||
| nodeList | bool | 否 | `false` | 只输出节点 |
|
||||
| Query 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
| ------------ | ------ | ------------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| sub | string | sub/proxy 至少有一项存在 | - | 订阅链接,可以在链接结尾加上`#名称`,来给订阅中的节点加上统一前缀(可以输入多个,用 `,` 分隔) |
|
||||
| proxy | string | sub/proxy 至少有一项存在 | - | 节点分享链接(可以输入多个,用 `,` 分隔) |
|
||||
| refresh | bool | 否 | `false` | 强制刷新配置(默认缓存 5 分钟) |
|
||||
| template | string | 否 | - | 外部模板链接或内部模板名称 |
|
||||
| ruleProvider | string | 否 | - | 格式 `[Behavior,Url,Group,Prepend,Name],[Behavior,Url,Group,Prepend,Name]...`,其中 `Group` 是该规则集使用的策略组名,`Prepend` 为 bool 类型,如果为 `true` 规则将被添加到规则列表顶部,否则添加到规则列表底部(会调整到 MATCH 规则之前) |
|
||||
| rule | string | 否 | - | 格式 `[Rule,Prepend],[Rule,Prepend]...`,其中 `Prepend` 为 bool 类型,如果为 `true` 规则将被添加到规则列表顶部,否则添加到规则列表底部(会调整到 MATCH 规则之前) |
|
||||
| autoTest | bool | 否 | `false` | 国家策略组是否自动测速 |
|
||||
| lazy | bool | 否 | `false` | 自动测速是否启用 lazy |
|
||||
| sort | string | 否 | `nameasc` | 国家策略组排序策略,可选值 `nameasc`、`namedesc`、`sizeasc`、`sizedesc` |
|
||||
| replace | string | 否 | - | 通过正则表达式重命名节点,格式 `[<ReplaceKey>,<ReplaceTo>],[<ReplaceKey>,<ReplaceTo>]...` |
|
||||
| remove | string | 否 | - | 通过正则表达式删除节点 |
|
||||
| nodeList | bool | 否 | `false` | 只输出节点 |
|
||||
|
||||
# `/short`
|
||||
|
||||
获取短链,Content-Type 为 `application/json`
|
||||
具体参考使用可以参考 [api\templates\index.html](api/static/index.html)
|
||||
|
||||
| Body 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
|----------|--------|------|-----|------------------|
|
||||
| url | string | 是 | - | 需要转换的 Query 参数部分 |
|
||||
| password | string | 否 | - | 短链密码 |
|
||||
| Body 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
| --------- | ------ | -------- | ------ | ------------------------- |
|
||||
| url | string | 是 | - | 需要转换的 Query 参数部分 |
|
||||
| password | string | 否 | - | 短链密码 |
|
||||
|
||||
# `/s/:hash`
|
||||
|
||||
短链跳转
|
||||
`hash` 为动态路由参数,可以通过 `/short` 接口获取
|
||||
|
||||
| Query 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
|----------|--------|------|-----|------|
|
||||
| password | string | 否 | - | 短链密码 |
|
||||
| Query 参数 | 类型 | 是否必须 | 默认值 | 说明 |
|
||||
| ---------- | ------ | -------- | ------ | -------- |
|
||||
| password | string | 否 | - | 短链密码 |
|
||||
|
56
README.md
56
README.md
@ -5,40 +5,40 @@
|
||||
|
||||
## 特性
|
||||
|
||||
- 开箱即用的规则、策略组配置
|
||||
- 自动根据节点名称按国家划分策略组
|
||||
- 支持多订阅合并
|
||||
- 支持添加自定义 Rule Provider、Rule
|
||||
- 支持多种协议
|
||||
- Shadowsocks
|
||||
- ShadowsocksR
|
||||
- Vmess
|
||||
- Vless (Clash.Meta)
|
||||
- Trojan
|
||||
- Hysteria (Clash.Meta)
|
||||
- Hysteria2 (Clash.Meta)
|
||||
- 开箱即用的规则、策略组配置
|
||||
- 自动根据节点名称按国家划分策略组
|
||||
- 支持多订阅合并
|
||||
- 支持添加自定义 Rule Provider、Rule
|
||||
- 支持多种协议
|
||||
- Shadowsocks
|
||||
- ShadowsocksR
|
||||
- Vmess
|
||||
- Vless (Clash.Meta)
|
||||
- Trojan
|
||||
- Hysteria (Clash.Meta)
|
||||
- Hysteria2 (Clash.Meta)
|
||||
|
||||
## 使用
|
||||
|
||||
### 运行
|
||||
|
||||
- [docker compose](./docker-compose.yml)
|
||||
- 运行[二进制文件](https://github.com/nitezs/sub2clash/releases/latest)
|
||||
- [docker compose](./docker-compose.yml)
|
||||
- 运行[二进制文件](https://github.com/nitezs/sub2clash/releases/latest)
|
||||
|
||||
### 配置
|
||||
|
||||
可以通过编辑 .env 文件来修改默认配置,docker 直接添加环境变量
|
||||
|
||||
| 变量名 | 说明 | 默认值 |
|
||||
|-----------------------|----------------------------------------|-----------------------|
|
||||
| PORT | 端口 | `8011` |
|
||||
| META_TEMPLATE | 默认 meta 模板文件名 | `template_meta.yaml` |
|
||||
| CLASH_TEMPLATE | 默认 clash 模板文件名 | `template_clash.yaml` |
|
||||
| REQUEST_RETRY_TIMES | Get 请求重试次数 | `3` |
|
||||
| REQUEST_MAX_FILE_SIZE | Get 请求订阅文件最大大小(byte) | `1048576` |
|
||||
| CACHE_EXPIRE | 订阅缓存时间(秒) | `300` |
|
||||
| 变量名 | 说明 | 默认值 |
|
||||
| --------------------- | ---------------------------------------------- | --------------------- |
|
||||
| PORT | 端口 | `8011` |
|
||||
| META_TEMPLATE | 默认 meta 模板文件名 | `template_meta.yaml` |
|
||||
| CLASH_TEMPLATE | 默认 clash 模板文件名 | `template_clash.yaml` |
|
||||
| REQUEST_RETRY_TIMES | Get 请求重试次数 | `3` |
|
||||
| REQUEST_MAX_FILE_SIZE | Get 请求订阅文件最大大小(byte) | `1048576` |
|
||||
| CACHE_EXPIRE | 订阅缓存时间(秒) | `300` |
|
||||
| LOG_LEVEL | 日志等级,可选值 `debug`,`info`,`warn`,`error` | `info` |
|
||||
| SHORT_LINK_LENGTH | 短链长度 | `6` |
|
||||
| SHORT_LINK_LENGTH | 短链长度 | `6` |
|
||||
|
||||
### API
|
||||
|
||||
@ -49,14 +49,14 @@
|
||||
可以通过变量自定义模板中的策略组代理节点
|
||||
解释的不太清楚,可以参考下方默认模板
|
||||
|
||||
- `<all>` 为添加所有节点
|
||||
- `<countries>` 为添加所有国家策略组
|
||||
- `<地区二位字母代码>` 为添加指定地区所有节点,例如 `<hk>` 将添加所有香港节点
|
||||
- `<all>` 为添加所有节点
|
||||
- `<countries>` 为添加所有国家策略组
|
||||
- `<地区二位字母代码>` 为添加指定地区所有节点,例如 `<hk>` 将添加所有香港节点
|
||||
|
||||
#### 默认模板
|
||||
|
||||
- [Clash](./templates/template_clash.yaml)
|
||||
- [Clash.Meta](./templates/template_meta.yaml)
|
||||
- [Clash](./templates/template_clash.yaml)
|
||||
- [Clash.Meta](./templates/template_meta.yaml)
|
||||
|
||||
## 已知问题
|
||||
|
||||
|
@ -46,6 +46,10 @@ func ParseShadowsocksR(proxy string) (model.Proxy, error) {
|
||||
remarks, err = DecodeBase64(params.Get("remarks"))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return model.Proxy{}, err
|
||||
}
|
||||
|
||||
result := model.Proxy{
|
||||
Name: remarks,
|
||||
Type: "ssr",
|
||||
|
@ -49,6 +49,7 @@ func ParseVless(proxy string) (model.Proxy, error) {
|
||||
Servername: params.Get("sni"),
|
||||
RealityOpts: model.RealityOptions{
|
||||
PublicKey: params.Get("pbk"),
|
||||
ShortID: params.Get("sid"),
|
||||
},
|
||||
}
|
||||
if params.Get("alpn") != "" {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,123 +5,123 @@ mode: Rule
|
||||
log-level: info
|
||||
proxies:
|
||||
proxy-groups:
|
||||
- name: 节点选择
|
||||
type: select
|
||||
proxies:
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 手动切换
|
||||
type: select
|
||||
proxies:
|
||||
- <all>
|
||||
- name: 游戏平台(中国)
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 游戏平台(全球)
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 巴哈姆特
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 哔哩哔哩
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Telegram
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: OpenAI
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Youtube
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Microsoft
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Onedrive
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Apple
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Netflix
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 广告拦截
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- name: 漏网之鱼
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 节点选择
|
||||
type: select
|
||||
proxies:
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 手动切换
|
||||
type: select
|
||||
proxies:
|
||||
- <all>
|
||||
- name: 游戏平台(中国)
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 游戏平台(全球)
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 巴哈姆特
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 哔哩哔哩
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Telegram
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: OpenAI
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Youtube
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Microsoft
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Onedrive
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Apple
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: Netflix
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
- name: 广告拦截
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- name: 漏网之鱼
|
||||
type: select
|
||||
proxies:
|
||||
- 节点选择
|
||||
- <countries>
|
||||
- 手动切换
|
||||
- DIRECT
|
||||
rules:
|
||||
- GEOSITE,private,DIRECT,no-resolve
|
||||
- GEOIP,private,DIRECT
|
||||
- GEOSITE,category-ads-all,广告拦截
|
||||
- GEOSITE,microsoft,Microsoft
|
||||
- GEOSITE,apple,Apple
|
||||
- GEOSITE,netflix,Netflix
|
||||
- GEOIP,netflix,Netflix
|
||||
- GEOSITE,onedrive,Onedrive
|
||||
- GEOSITE,youtube,Youtube
|
||||
- GEOSITE,telegram,Telegram
|
||||
- GEOIP,telegram,Telegram
|
||||
- GEOSITE,openai,OpenAI
|
||||
- GEOSITE,bilibili,哔哩哔哩
|
||||
- GEOSITE,bahamut,巴哈姆特
|
||||
- GEOSITE,category-games@cn,游戏平台(中国)
|
||||
- GEOSITE,category-games,游戏平台(全球)
|
||||
- GEOSITE,geolocation-!cn,节点选择
|
||||
- GEOSITE,CN,DIRECT
|
||||
- GEOIP,CN,DIRECT
|
||||
- MATCH,漏网之鱼
|
||||
- GEOSITE,private,DIRECT,no-resolve
|
||||
- GEOIP,private,DIRECT
|
||||
- GEOSITE,category-ads-all,广告拦截
|
||||
- GEOSITE,microsoft,Microsoft
|
||||
- GEOSITE,apple,Apple
|
||||
- GEOSITE,netflix,Netflix
|
||||
- GEOIP,netflix,Netflix
|
||||
- GEOSITE,onedrive,Onedrive
|
||||
- GEOSITE,youtube,Youtube
|
||||
- GEOSITE,telegram,Telegram
|
||||
- GEOIP,telegram,Telegram
|
||||
- GEOSITE,openai,OpenAI
|
||||
- GEOSITE,bilibili,哔哩哔哩
|
||||
- GEOSITE,bahamut,巴哈姆特
|
||||
- GEOSITE,category-games@cn,游戏平台(中国)
|
||||
- GEOSITE,category-games,游戏平台(全球)
|
||||
- GEOSITE,geolocation-!cn,节点选择
|
||||
- GEOSITE,CN,DIRECT
|
||||
- GEOIP,CN,DIRECT
|
||||
- MATCH,漏网之鱼
|
||||
|
@ -27,9 +27,6 @@ func ConnectDB() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
DB = db
|
||||
err = db.AutoMigrate(&model.ShortLink{})
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user