Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: 拦截配置功能,允许匹配到多个 域名匹配串 下的拦截配置了,只要域名符合 域名匹配串 #286

Merged

Conversation

wangliang181230
Copy link
Contributor

@wangliang181230 wangliang181230 commented Mar 29, 2024

Ⅰ. 描述此PR的作用:

  1. feature: 在匹配拦截配置时,可匹配到多个 ‘域名匹配符’ 下的拦截配置;
  2. optimize: 拦截配置中的proxy配置,可以使用绝对地址了,如:proxy: https://github.com/favicon.ico
  3. optimize: 拦截配置中的redirect配置,可以使用绝对地址了,如:redirect: https://github.com/favicon.ico
  4. optimize: 拦截配置中的redirect配置,可以使用 ${host} 了,如 proxy 配置;
  5. optimize: 拦截配置或远程配置中,可以配置某个配置项的值为 [delete],来移除某个配置了;(原版本只有远程配置可以移除配置值为null的配置项)

新功能配置举例及效果说明:

  1. 拦截配置如下:
{
    "*.github.com": {
        ".*": {
            "sni": "baidu.com"
        },
        "xxx": {
            "yyy": "zzz"
        }
    },
    "github.com": {
        "/.*/.*/releases/download/": {
            "redirect": "gh.api.99988866.xyz/https://github.com",
            "desc": "release文件加速下载跳转地址"
        },
        "xxx": "[delete]" // 域名直接匹配,优先级更高,将会删除 `*.github.com` 中的 xxx 配置项。
    },
    "collect.github.com": {
        "/github/collect": {
            "success": true,
            "status": 204,
            "desc": "采集数据,快速成功"
        }
    }
}
  1. 当访问域名 github.com 时,匹配到拦截配置:
{
    ".*": {
        "sni": "baidu.com"
    },
    "xxx": {
        "yyy": "zzz"
    },
    "/.*/.*/releases/download/": {
        "redirect": "gh.api.99988866.xyz/https://github.com",
        "desc": "release文件加速下载跳转地址"
    }
}
  1. 当访问域名 collect.github.com 时,匹配到拦截配置:
{
    ".*": {
        "sni": "baidu.com"
    },
    "/github/collect": {
        "success": true,
        "status": 204,
        "desc": "采集数据,快速成功"
    }
}

Ⅱ. 此PR修复了哪个issue吗?

@wangliang181230 wangliang181230 added the Feature 新特性PR label Mar 29, 2024
@wangliang181230 wangliang181230 changed the title feature: 在匹配拦截配置时,可匹配到多个 ‘域名匹配符’ 下的拦截配置。 feature: 拦截配置功能,可匹配到多个 ‘域名匹配符’ 下的拦截配置。 Mar 29, 2024
@wangliang181230 wangliang181230 changed the title feature: 拦截配置功能,可匹配到多个 ‘域名匹配符’ 下的拦截配置。 feature: 拦截配置功能,允许匹配到多个 ‘域名匹配符’ 下的拦截配置了,只要域名符合 ‘域名匹配符’。 Mar 29, 2024
@wangliang181230 wangliang181230 merged commit 74c1473 into docmirror:master Mar 29, 2024
@wangliang181230 wangliang181230 deleted the multiple-interceptors- branch March 29, 2024 14:36
@wangliang181230 wangliang181230 changed the title feature: 拦截配置功能,允许匹配到多个 ‘域名匹配符’ 下的拦截配置了,只要域名符合 ‘域名匹配符’。 feature: 拦截配置功能,允许匹配到多个 域名匹配串 下的拦截配置了,只要域名符合 域名匹配串 Apr 1, 2024
@wangliang181230 wangliang181230 added this to the 1.8.0 milestone Apr 11, 2024
@wangliang181230 wangliang181230 added v1.8.0 1.8.0版本 and removed v1.8.0 1.8.0版本 labels Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature 新特性PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant