浏览器代理插件@按规则自动切换代理模式@ZeroOmega配置协议分流@http链接直连

文章目录

abstract

本文介绍为现代浏览器(以edge)为例,配置浏览器对不同url配置不同代理,尤其是根据协议选择是否走代理

以http://和https://为例,假设我希望前者不走代理(或者总是直连),而后者走代理(或者更加精细的代理规则)

插件选择

功能类似的插件较多,这里选择相对功能比较完善的,对chromium和系和火狐系浏览器都支持良好的ZeroOmega

GitHub - zero-peak/ZeroOmega: Manage and switch between multiple proxies quickly & easily.

配置案例

将配置保存为.json文件(或.txt等任何文本文件)

然后在插件设置中导入此文本文件

供参考的在线版本(包含三组规则,不过每组规则都差不多,只是端口不一样而已):(可能会失效)

http 复制代码
https://gitee.com/xuchaoxin1375/scripts/raw/main/Config/ZeroOmegaOptions.json

下面是使用本地透明代理http://localhost:10808 创建的代理规则

为了实现根据url链接分流,需要创建一个自动切换auto-switch的情景模式(profile),在两种模式在自动切换:

  • 如果url是http://链接,则走Direct模式(直连不走代理),注意,直接连接模式是默认存在的模式,不需要手动创建,在自动切换模式中编写切换规则时,可以直接引用直接连接模式
  • 如果url是https://链接,则走代理,这里需要通过选择已经创建好的普通情景模式

第一个重要步骤是创建一个普通代理情景模式(proxy profile,代理服务器)

例如下面的简单情景模式(几乎是默认的,不过普通情景模式允许你通过域名通配符绕过一些不需要走代理的网站,例如访问特征明显的国内网站(.cn)网站,具体比如bt.cn),这种即便是https链接也不推荐走代理

第二个重要步骤,在自动情景模式中配置模式切换规则

导出的备份参考(json)

json 复制代码
{
    "+auto-direct-10808": {
        "color": "#ca0",
        "defaultProfileName": "direct",
        "name": "auto-direct-10808",
        "profileType": "SwitchProfile",
        "revision": "19aa60318dc",
        "rules": [
            {
                "condition": {
                    "conditionType": "UrlWildcardCondition",
                    "pattern": "http://*"
                },
                "profileName": "direct"
            },
            {
                "condition": {
                    "conditionType": "UrlWildcardCondition",
                    "pattern": "https://*"
                },
                "profileName": "https10808"
            }
        ]
    },
    "+https10808": {
        "bypassList": [
            {
                "conditionType": "BypassCondition",
                "pattern": "127.0.0.1"
            },
            {
                "conditionType": "BypassCondition",
                "pattern": "[::1]"
            },
            {
                "conditionType": "BypassCondition",
                "pattern": "localhost"
            },
            {
                "conditionType": "BypassCondition",
                "pattern": "*.cn"
            },
            {
                "conditionType": "BypassCondition",
                "pattern": "*.test"
            }
        ],
        "color": "#9ce",
        "fallbackProxy": {
            "host": "localhost",
            "port": 10808,
            "scheme": "http"
        },
        "name": "https10808",
        "profileType": "FixedProfile",
        "revision": "19aa9545f9f"
    },
    "-addConditionsToBottom": false,
    "-confirmDeletion": true,
    "-downloadInterval": 1440,
    "-enableQuickSwitch": false,
    "-monitorWebRequests": true,
    "-quickSwitchProfiles": [],
    "-refreshOnProfileChange": true,
    "-revertProxyChanges": true,
    "-showConditionTypes": 1,
    "-showExternalProfile": true,
    "-showInspectMenu": true,
    "-showResultProfileOnActionBadgeText": false,
    "-startupProfileName": "",
    "schemaVersion": 2
}
相关推荐
geovindu15 小时前
rust: Semaphore Pattern
开发语言·后端·设计模式·rust·代理模式·企业级信号量模式·同步型模式
一切皆是因缘际会2 天前
最优 控制
代理模式
AAA程序技术6 天前
从 DOM 到屏幕:浏览器渲染管线六步拆解
前端·浏览器
\光辉岁月/6 天前
3.spring5-AOP
spring·代理模式·aop·spring5
AI_Cloud_推荐12 天前
DeepSeek-V4-Pro 的 4.5 和 12:不是加价,是同名不同版本
阿里云·语言模型·代理模式·ai编程·百度云
szp200512 天前
Cache API 会丢掉 URL 里的 #:我的 9 个模型分块一直写在同一条缓存上
javascript·浏览器
SoulRoar.14 天前
Armbian 上为虚拟桌面安装 Chromium 浏览器
浏览器·armbian·虚拟显示器
Summer-Bright14 天前
浏览器成了AI应用的新入口:智能体接管标签页之后,三本账谁买单
人工智能·chatgpt·agent·浏览器·智能体
ShineWinsu15 天前
对于CSS:弹性布局(Flexbox)的解析
前端·css·面试·浏览器·web·网页·弹性布局
devilnumber16 天前
Java 代理模式(简单理解回顾)
java·开发语言·代理模式