浏览器代理插件@按规则自动切换代理模式@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
}
相关推荐
未若君雅裁1 天前
斐波那契数列 - 动态规划实现 详解笔记
java·数据结构·笔记·算法·动态规划·代理模式
小毛驴8501 天前
软件设计模式-代理模式
设计模式·系统安全·代理模式
拉不动的猪2 天前
文件下载:后端配置、前端方式与进度监控
前端·javascript·浏览器
WKP94185 天前
装饰器模式和代理模式
代理模式·装饰器模式
不一样的少年_5 天前
大部分人都错了!这才是chrome插件多脚本通信的正确姿势
前端·javascript·浏览器
阿沁QWQ7 天前
HTTP cookie 与 session
c++·浏览器·edge浏览器·cookie·session
克里斯蒂亚L8 天前
开发一个计时器组件
前端·浏览器
拉不动的猪11 天前
浏览器之内置四大多线程API
前端·javascript·浏览器
不一样的少年_12 天前
【前端效率工具】再也不用 APIfox 联调!零侵入 Mock,全程不改代码、不开代理
前端·javascript·浏览器