WebExtension代理API:解析SOCKS5代理上的DNS条目(不在本地系统上) [英] WebExtension proxy API: Resolve DNS entries on SOCKS5 proxy (not on the local system)

查看:171
本文介绍了WebExtension代理API:解析SOCKS5代理上的DNS条目(不在本地系统上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firefox中是否使用WebExtension proxy API 是否支持在使用SOCKS 5时解析代理服务器上的DNS?

Does the WebExtension proxy API in Firefox support to resolve DNS on the proxy server when using SOCKS 5?

nsIProtocolProxyService API ,这在WebExtensions中不再可用,这是有可能的.您可以将 Components.interfaces.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST 标志传递给

In the nsIProtocolProxyService API, which is no longer available in WebExtensions, it was possible. You could pass the flag Components.interfaces.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST to nsIProtocolProxyService.newProxyInfo:

如果代理本身要执行名称解析,则设置此标志.在这种情况下,主机名会以某种方式使用,我们不应该自己进行任何形式的DNS查找

This flag is set if the proxy is to perform name resolution itself. If this is the case, the hostname is used in some fashion, and we shouldn't do any form of DNS lookup ourselves

新的WebExtensions代理API中是否有某些等效选项?

Is there some equivalent option in the new proxy API for WebExtensions?

推荐答案

现在,WebExtension API可以使用代理DNS.由于错误1381290 已登陆Nightly,因此代理脚本可以返回对象数组而不是字符串.在提议中,对象具有以下属性:

Now it has become possible for WebExtension API to use proxy DNS. Since Bug 1381290 has landed in Nightly, the proxy script can return an array of objects instead of a string. In proposal, the objects have the following properties:

  • |类型|-字符串,"http" |"https |" socks5"||" socks4"|" socks"|"直接"|"忽略"|之一.袜子"是socks5的同义词.忽略"表示Firefox应该处理通过其全局代理设置(可以是wpad,pac,系统,直接/无或代理服务器)或其他已安装的插件.
  • |主机|-字符串
  • |端口|-1到65536之间的整数(TCP/IP不允许超出该范围的端口)
  • |用户名|-可选字符串
  • |密码|-可选字符串
  • | 代理DNS |-可选的布尔值.默认为false.如果为true,则将TRANSPARENT_PROXY_RESOLVES_HOST设置为nsIProxyInfo.flags上的标志以便使用代理服务器来解析某些DNS查询.
  • | failoverTimeout |-可选的整数.默认值1.超时并尝试故障转移阵列中的下一个代理之前的秒数
  • |故障转移|-具有这些相同属性的对象的可选数组.null终止.默认为null(不进行故障转移,这是所需的根据我的经验有99%的情况).
  • |type| -- string, one of "http"|"https|"socks5"|"socks4"|"socks"|"direct"|"ignore"|. note that "socks" is a synonym for socks5. "ignore" means Firefox should handle this URI through its global proxy settings (which could be wpad, pac, system, direct/none, or a proxy server) or other installed addons.
  • |host| -- string
  • |port| -- integer between 1 and 65536 (TCP/IP does not allow for ports outside that range)
  • |username| -- optional string
  • |password| -- optional string
  • |proxyDNS| -- optional boolean. default false. if true, TRANSPARENT_PROXY_RESOLVES_HOST is set as a flag on nsIProxyInfo.flags so that the proxy server is used to resolve certain DNS queries.
  • |failoverTimeout| -- optional integer. default 1. Number of seconds before timing out and trying the next proxy in the failover array
  • |failover| -- optional array of objects with these same properties. null to terminate. default null (no failover, which is the desired case 99% of the time in my experience).

例如:

{
  type: "socks",
  host: "foo.com",
  port: 1080,
  proxyDNS: true,
  failoverTimeout: 1,
  failover: {
    type: "socks",
    host: "bar.com",
    port: 1080,
    proxyDNS: true,
    failoverTimeout: 0,
    failover: null
  }
}


但是在实际的补丁程序中,我看不到该阵列中的故障转移"选项:


But in the actual patch I can see no 'failover' option in that array:

+    for (let prop of ["type", "host", "port", "username", "password", "proxyDNS", "failoverTimeout"]) {
+      this[prop](proxyData);
+    }

故障转移"服务器的定义如下:

And the 'failover' server seems to be defined like this:

+    let failoverProxy = proxyDataList.length > 0 ? this.createProxyInfoFromData(proxyDataList, defaultProxyInfo) : defaultProxyInfo;


相关信息:


Related Info:

这篇关于WebExtension代理API:解析SOCKS5代理上的DNS条目(不在本地系统上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆