From 3d6f7c19555353d45df181a3af9e2ceb81e31dfc Mon Sep 17 00:00:00 2001 From: 7Sageer <125936732+7Sageer@users.noreply.github.com> Date: Sun, 1 Sep 2024 10:57:06 +0800 Subject: [PATCH] feat: update document --- README.md | 16 +++++++++------- doc/API-doc-en.md | 28 ++++++++++++++++------------ doc/API-doc.md | 12 ++++++++---- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 1a4b17c..6c38e7f 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,15 @@ Sublink Worker 是一个可部署在 Cloudflare Worker 上轻量级的订阅转 ## 最近更新 -### 2024-08-28 +### 2024-09-01 + +- 自定义规则现在支持以下规则: + - domain_suffix + - ip_cidr + - geoip + - geosite + +### 2024-08-25 - 修复 ClashMeta For Android 高于[v2.10.1]版本不显示规则集的问题 @@ -55,12 +63,6 @@ Sublink Worker 是一个可部署在 Cloudflare Worker 上轻量级的订阅转 - 自定义规则 - 自定义规则的 API 支持,详见 [API-doc.md](/doc/API-doc.md) -### 2024-08-19 - -- 更新规则集: - - `💬 AI 服务` 规则集增加 `Perplexity` - - `💰 金融服务` 规则集增加 `Stripe`, `Wise` - ## 项目结构 - `index.js`: 主要的服务器逻辑,处理请求路由 diff --git a/doc/API-doc-en.md b/doc/API-doc-en.md index 62dbdc0..c173d2d 100644 --- a/doc/API-doc-en.md +++ b/doc/API-doc-en.md @@ -2,7 +2,7 @@ ## Overview -Sublink Worker is a lightweight subscription conversion tool deployed on Cloudflare Workers. It can convert sharing URLs of various proxy protocols into subscription links usable by different clients. This document outlines the API endpoints and their usage. +Sublink Worker is a lightweight subscription conversion tool deployed on Cloudflare Workers. It can convert shared URLs of various proxy protocols into subscription links usable by different clients. This document outlines the API endpoints and their usage. ## Base URL @@ -24,12 +24,12 @@ Replace `your-worker-domain` with your actual Cloudflare Workers domain. - **Method**: GET - **Parameters**: - `config` (required): URL-encoded string containing one or more proxy configurations - - `selectedRules` (optional): Name of predefined rule set or JSON array of custom rules + - `selectedRules` (optional): Name of a predefined rule set or JSON array of custom rules - `customRules` (optional): JSON array of custom rules **Example**: ``` -/singbox?config=vmess%3A%2F%2Fexample&selectedRules=balanced&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D +/singbox?config=vmess%3A%2F%2Fexample&selectedRules=balanced&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22domain_suffix%22%3A%5B%22.com%22%5D%2C%22ip_cidr%22%3A%5B%2210.0.0.0%2F8%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D ``` #### Clash Configuration @@ -50,7 +50,7 @@ Replace `your-worker-domain` with your actual Cloudflare Workers domain. - **URL**: `/shorten` - **Method**: GET - **Parameters**: - - `url` (required): Original URL to be shortened + - `url` (required): The original URL to be shortened **Example**: ``` @@ -80,7 +80,7 @@ The API supports the following predefined rule sets: These can be used in the `selectedRules` parameter for Sing-Box and Clash configurations. -Below are the currently supported predefined rule sets: +Here are the currently supported predefined rule sets: | Rule Name | Used Site Rules | Used IP Rules | |---|---|---| @@ -103,14 +103,16 @@ Below are the currently supported predefined rule sets: | Financial | paypal, visa, mastercard, stripe, wise | | | Cloud Services | aws, azure, digitalocean, heroku, dropbox | | -Singbox rule sets are sourced from [https://github.com/lyc8503/sing-box-rules](https://github.com/lyc8503/sing-box-rules), thanks to lyc8503's contribution! +The rule sets for Singbox are from [https://github.com/lyc8503/sing-box-rules](https://github.com/lyc8503/sing-box-rules), thanks to lyc8503 for the contribution! ## Custom Rules -In addition to using predefined rule sets, you can provide a list of custom rules in the `customRules` parameter as a JSON array. Each custom rule should include the following fields: +In addition to using predefined rule sets, you can provide a list of custom rules in the `customRules` parameter as a JSON array. Each custom rule should contain the following fields: - `sites`: Array of domain rules - `ips`: Array of IP rules +- `domain_suffix`: Array of domain suffix rules +- `ip_cidr`: Array of IP CIDR rules - `outbound`: Outbound name Example: @@ -120,6 +122,8 @@ Example: { "sites": ["google", "anthropic"], "ips": ["private", "cn"], + "domain_suffix": [".com", ".org"], + "ip_cidr": ["192.168.0.0/16", "10.0.0.0/8"], "outbound": "🤪 MyCustomRule" } ] @@ -127,10 +131,10 @@ Example: ## Error Handling -The API will return appropriate HTTP status codes and error messages when issues occur: +The API will return appropriate HTTP status codes and error messages when problems occur: - 400 Bad Request: When required parameters are missing or invalid -- 404 Not Found: When the requested resource (like a short URL) doesn't exist +- 404 Not Found: When the requested resource (such as a short URL) doesn't exist - 500 Internal Server Error: Server-side errors ## Usage Notes @@ -149,7 +153,7 @@ The API will return appropriate HTTP status codes and error messages when issues 2. Generate a Clash configuration with custom rules: ``` - /clash?config=vless%3A%2F%2Fexample&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D + /clash?config=vless%3A%2F%2Fexample&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22domain_suffix%22%3A%5B%22.com%22%5D%2C%22ip_cidr%22%3A%5B%2210.0.0.0%2F8%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D ``` 3. Shorten a URL: @@ -159,6 +163,6 @@ The API will return appropriate HTTP status codes and error messages when issues ## Conclusion -Our API provides a flexible and powerful way to generate and manage proxy configurations. It supports multiple proxy protocols, various client types, and customizable routing rules. The URL shortening feature allows for easy sharing and management of complex configurations. +The Sublink Worker API provides a flexible and powerful way to generate and manage proxy configurations. It supports multiple proxy protocols, various client types, and customizable routing rules. The URL shortening feature allows for easy sharing and management of complex configurations. -For any questions or feature requests, please contact the repository maintainer. \ No newline at end of file +For any questions or feature requests, please contact [@7Sageer](https://github.com/7Sageer). \ No newline at end of file diff --git a/doc/API-doc.md b/doc/API-doc.md index e287e68..a61f7ac 100644 --- a/doc/API-doc.md +++ b/doc/API-doc.md @@ -29,7 +29,7 @@ https://your-worker-domain.workers.dev **示例**: ``` -/singbox?config=vmess%3A%2F%2Fexample&selectedRules=balanced&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D +/singbox?config=vmess%3A%2F%2Fexample&selectedRules=balanced&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22domain_suffix%22%3A%5B%22.com%22%5D%2C%22ip_cidr%22%3A%5B%2210.0.0.0%2F8%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D ``` #### Clash 配置 @@ -111,6 +111,8 @@ Singbox 的规则集来自 [https://github.com/lyc8503/sing-box-rules](https://g - `sites`: 域名规则数组 - `ips`: IP 规则数组 +- `domain_suffix`: 域名后缀规则数组 +- `ip_cidr`: IP CIDR 规则数组 - `outbound`: 出站名称 示例: @@ -120,6 +122,8 @@ Singbox 的规则集来自 [https://github.com/lyc8503/sing-box-rules](https://g { "sites": ["google", "anthropic"], "ips": ["private", "cn"], + "domain_suffix": [".com", ".org"], + "ip_cidr": ["192.168.0.0/16", "10.0.0.0/8"], "outbound": "🤪 MyCustomRule" } ] @@ -149,7 +153,7 @@ API 在出现问题时将返回适当的 HTTP 状态码和错误消息: 2. 生成带有自定义规则的 Clash 配置: ``` - /clash?config=vless%3A%2F%2Fexample&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D + /clash?config=vless%3A%2F%2Fexample&customRules=%5B%7B%22sites%22%3A%5B%22example.com%22%5D%2C%22ips%22%3A%5B%22192.168.1.1%22%5D%2C%22domain_suffix%22%3A%5B%22.com%22%5D%2C%22ip_cidr%22%3A%5B%2210.0.0.0%2F8%22%5D%2C%22outbound%22%3A%22MyCustomRule%22%7D%5D ``` 3. 缩短 URL: @@ -159,6 +163,6 @@ API 在出现问题时将返回适当的 HTTP 状态码和错误消息: ## 结论 -我们的 API 提供了一种灵活而强大的方式来生成和管理代理配置。它支持多种代理协议、各种客户端类型和可自定义的路由规则。URL 缩短功能允许轻松共享和管理复杂的配置。 +Sublink Worker API 提供了一种灵活而强大的方式来生成和管理代理配置。它支持多种代理协议、各种客户端类型和可自定义的路由规则。URL 缩短功能允许轻松共享和管理复杂的配置。 -如有任何问题或功能请求,欢迎联系仓库维护者。 \ No newline at end of file +如有任何问题或功能请求,欢迎联系[@7Sageer](https://github.com/7Sageer)。