Skip to content

Commit

Permalink
feat: support inline proxy provider
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchengjie committed Dec 26, 2024
1 parent cbefc26 commit 043aa79
Show file tree
Hide file tree
Showing 13 changed files with 1,274 additions and 1,179 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
### changes

- 新增:rule-providers 新增 `inline` 内联规则配置
- 新增:proxy-providers 新增 `inline` 内联proxies配置
- 调整: outbound 的 `header` 配置项宽松,不再限制value的类型为 string

### Bugs Fixes

- 修复: `tuic` V4 的 `token` 配置项类型错误

---

Expand Down
3 changes: 1 addition & 2 deletions src/modules/adapter/outbound/http.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@
"type": "object",
"title": "请求头",
"description": "请求头",
"markdownDescription": "请求头",
"additionalProperties": { "type": "string" }
"markdownDescription": "请求头"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/modules/adapter/outbound/mieru.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"markdownEnumDescriptions": ["默认", "禁用", "", "", ""],
"title": "多路复用级别",
"description": "多路复用级别",
"markdownDescription": "多路复用级别"
"markdownDescription": "多路复用级别",
"default": "MULTIPLEXING_LOW"
}
},
"anyOf": [{ "required": ["port"] }, { "required": ["port-range"] }],
Expand Down
3 changes: 1 addition & 2 deletions src/modules/adapter/outbound/shadowsocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
"type": "object",
"title": "请求头",
"description": "请求头",
"markdownDescription": "请求头",
"additionalProperties": { "type": "string" }
"markdownDescription": "请求头"
},
"skip-cert-verify": {
"$ref": "#/definitions/compatible/boolean",
Expand Down
3 changes: 1 addition & 2 deletions src/modules/adapter/outbound/vless.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@
"type": "object",
"title": "ws请求头",
"description": "ws请求头",
"markdownDescription": "ws请求头",
"additionalProperties": { "type": "string" }
"markdownDescription": "ws请求头"
},
"fingerprint": {
"$ref": "#/definitions/enums/fingerprint",
Expand Down
6 changes: 2 additions & 4 deletions src/modules/adapter/outbound/vmess.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"type": "object",
"title": "请求头",
"description": "请求头",
"markdownDescription": "请求头",
"additionalProperties": { "type": "string" }
"markdownDescription": "请求头"
}
}
},
Expand Down Expand Up @@ -83,8 +82,7 @@
"type": "object",
"title": "请求头",
"description": "请求头",
"markdownDescription": "请求头",
"additionalProperties": { "type": "string" }
"markdownDescription": "请求头"
},
"max-early-data": {
"$ref": "#/definitions/compatible/integer",
Expand Down
81 changes: 51 additions & 30 deletions src/modules/adapter/provider/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"definitions": {
"types": { "$ref": "../../../definitions/types.json" },
"patterns": { "$ref": "../../../definitions/patterns.json" },
"enums": { "$ref": "../../../definitions/enums.json" },
"health-check": { "$ref": "./health-check.json" }
"enums": { "$ref": "../../../definitions/enums.json" }
},
"patternProperties": {
"^default$": { "type": "null", "errorMessage": "不能使用default作为provider的名称" }
Expand All @@ -15,8 +14,8 @@
"required": ["type"],
"properties": {
"type": {
"enum": ["file", "http"],
"markdownEnumDescriptions": ["本地文件", "网络文件"],
"enum": ["file", "http", "inline"],
"markdownEnumDescriptions": ["本地文件", "网络文件", "内联proxies"],
"title": "provider类型",
"description": "provider类型",
"markdownDescription": "provider类型"
Expand Down Expand Up @@ -181,34 +180,56 @@
},
"header": { "type": "object", "errorMessage": "类型应为object" }
},
"if": {
"properties": {
"type": { "const": "http" }
}
},
"then": {
"required": ["url"],
"properties": {
"url": {
"$ref": "#/definitions/patterns/httpUrl",
"title": "provider网络文件地址",
"description": "provider网络文件地址",
"markdownDescription": "provider网络文件地址"
},
"proxy": {
"type": "string",
"title": "使用指定代理下载/更新provider",
"description": "使用指定代理下载/更新provider",
"markdownDescription": "使用指定代理下载/更新provider"
"allOf": [
{
"if": { "properties": { "type": { "const": "file" } } },
"then": { "required": ["path"] }
},
{
"if": {
"properties": {
"type": { "const": "http" }
}
},
"size-limit": {
"type": "integer",
"title": "限制下载文件大小",
"description": "单位:KB,0为不限制",
"markdownDescription": "单位:KB,0为不限制",
"default": 0
"then": {
"required": ["url"],
"properties": {
"url": {
"$ref": "#/definitions/patterns/httpUrl",
"title": "provider网络文件地址",
"description": "provider网络文件地址",
"markdownDescription": "provider网络文件地址"
},
"proxy": {
"type": "string",
"title": "使用指定代理下载/更新provider",
"description": "使用指定代理下载/更新provider",
"markdownDescription": "使用指定代理下载/更新provider"
},
"size-limit": {
"type": "integer",
"title": "限制下载文件大小",
"description": "单位:KB,0为不限制",
"markdownDescription": "单位:KB,0为不限制",
"default": 0
}
}
}
},
{
"if": { "properties": { "type": { "const": "inline" } } },
"then": {
"required": ["payload"],
"properties": {
"payload": {
"$ref": "#/definitions/proxies",
"title": "proxies内容",
"description": "proxies内容",
"markdownDescription": "proxies内容"
}
}
}
}
}
]
}
}
3 changes: 2 additions & 1 deletion src/modules/config/proxy-providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"types": { "$ref": "../../definitions/types.json" },
"patterns": { "$ref": "../../definitions/patterns.json" },
"enums": { "$ref": "../../definitions/enums.json" },
"health-check": { "$ref": "../adapter/provider/health-check.json" }
"health-check": { "$ref": "../adapter/provider/health-check.json" },
"proxies": { "$ref": "../config/proxies.json" }
},
"$ref": "../adapter/provider/provider.json"
}
6 changes: 3 additions & 3 deletions src/modules/config/sniffer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"markdownDescription": "默认情况下只对IP进行嗅探"
},
"skip-domain": {
"$ref": "#/definitions/types/domainWildcardArray",
"$ref": "#/definitions/types/stringArray",
"title": "需要跳过嗅探的域名",
"description": "默认情况下只对IP进行嗅探",
"markdownDescription": "默认情况下只对IP进行嗅探"
Expand All @@ -49,14 +49,14 @@
"title": "限制嗅探类型范围",
"description": "支持TLS,HTTP,QUIC",
"markdownDescription": "支持`TLS`,`HTTP`,`QUIC`",
"deprecationMessage": "推荐使用sniff"
"deprecationMessage": "已废弃,使用sniff代替"
},
"port-whitelist": {
"$ref": "#/definitions/types/portRangeArray",
"title": "限制嗅探端口范围",
"description": "要求搭配sniffing使用(格式:80 或 80-88)",
"markdownDescription": "要求搭配`sniffing`使用(格式:`80` 或 `80-88`)",
"deprecationMessage": "推荐使用sniff"
"deprecationMessage": "已废弃,使用sniff代替"
},
"force-dns-mapping": {
"type": "boolean",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/listener/config/tuic.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"markdownDescription": "多个使用,分隔"
},
"token": {
"type": "string",
"$ref": "#/definitions/types/stringArray",
"title": "Token",
"description": "Token",
"markdownDescription": "Token"
Expand Down
2 changes: 1 addition & 1 deletion src/modules/listener/inbound/tuic.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"required": ["certificate", "private-key"],
"properties": {
"token": {
"type": "string",
"$ref": "#/definitions/types/stringArray",
"title": "TUIC V4的用户标识",
"description": "TUIC V4的用户标识",
"markdownDescription": "TUIC `V4`的用户标识"
Expand Down
3 changes: 1 addition & 2 deletions src/modules/listener/inbound/tun.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@
"$ref": "#/definitions/patterns/ipv4",
"title": "TUN接口的IPv4前缀",
"description": "TUN接口的IPv4前缀",
"markdownDescription": "`TUN`接口的`IPv4`前缀",
"deprecationMessage": "已弃用"
"markdownDescription": "`TUN`接口的`IPv4`前缀"
},
"inet6-address": {
"$ref": "#/definitions/patterns/ipv6",
Expand Down
Loading

0 comments on commit 043aa79

Please sign in to comment.