浏览器代理插件@按规则自动切换代理模式@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
}
相关推荐
1024肥宅2 小时前
浏览器存储 API:全面解析与高级实践
前端·数据库·浏览器
dyxal7 小时前
动态规划:给“最优解”一张记住过去的备忘录
算法·动态规划·代理模式
Robot侠1 天前
第四章:蒙特卡洛方法
代理模式
1024肥宅1 天前
浏览器相关 API:DOM 操作全解析
前端·浏览器·dom
码农胖大海1 天前
浏览器及标签页关闭时登出的解决方案
前端·浏览器
__万波__1 天前
二十三种设计模式(十二)--代理模式
java·设计模式·代理模式
用户90443816324602 天前
从40亿设备漏洞到AI浏览器:藏在浏览器底层的3个“隐形”原理
前端·javascript·浏览器
敲代码的瓦龙2 天前
what?动态规划?
代理模式
老毛肚3 天前
Java两种代理模式详解
java·开发语言·代理模式
winfredzhang3 天前
Python桌面应用开发:浏览器录制与视频合并工具详解
python·音视频·浏览器·视频合并·视频录制·视频预览