@ekhein/http-request 1.0.27 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/proxy/android.proxy.d.ts +1 -1
- package/dist/proxy/android.proxy.js +8 -4
- package/dist/proxy/liuguan.proxy.d.ts +7 -21739
- package/dist/proxy/liuguan.proxy.js +19 -25
- package/package.json +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.LiuGuanProxy = exports.LIUGUAN_ADCODE_MAP = void 0;
|
|
4
|
-
const
|
|
7
|
+
const util_1 = __importDefault(require("util"));
|
|
5
8
|
const proxy_agent_1 = require("proxy-agent");
|
|
6
9
|
exports.LIUGUAN_ADCODE_MAP = {
|
|
7
10
|
["110000"]: {
|
|
@@ -21738,35 +21741,26 @@ exports.LIUGUAN_ADCODE_MAP = {
|
|
|
21738
21741
|
}
|
|
21739
21742
|
};
|
|
21740
21743
|
class LiuGuanProxy extends proxy_agent_1.ProxyAgent {
|
|
21741
|
-
constructor(
|
|
21744
|
+
constructor(options) {
|
|
21742
21745
|
super({
|
|
21743
|
-
getProxyForUrl
|
|
21744
|
-
const
|
|
21745
|
-
const password = new URLSearchParams(
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
const area = (0, lodash_1.get)(exports.LIUGUAN_ADCODE_MAP, opts.adcode);
|
|
21752
|
-
password.set("cid", area.cCode);
|
|
21753
|
-
password.set("pid", area.pCode);
|
|
21746
|
+
getProxyForUrl() {
|
|
21747
|
+
const username = String(process.env.PROXY_LIUGUAN_USERNAME);
|
|
21748
|
+
const password = new URLSearchParams(process.env.PROXY_LIUGUAN_PASSWORD);
|
|
21749
|
+
if (options.adcode) {
|
|
21750
|
+
if (options.adcode in exports.LIUGUAN_ADCODE_MAP) {
|
|
21751
|
+
password.set("cid", exports.LIUGUAN_ADCODE_MAP[options.adcode]["cCode"]);
|
|
21752
|
+
password.set("pid", exports.LIUGUAN_ADCODE_MAP[options.adcode]["pCode"]);
|
|
21753
|
+
}
|
|
21754
21754
|
}
|
|
21755
|
-
if (
|
|
21756
|
-
password.set("uid",
|
|
21755
|
+
if (options.visitorId) {
|
|
21756
|
+
password.set("uid", options.visitorId);
|
|
21757
21757
|
}
|
|
21758
|
-
if (
|
|
21759
|
-
password.set("unbindTime",
|
|
21758
|
+
if (options.unbindTime) {
|
|
21759
|
+
password.set("unbindTime", options.unbindTime);
|
|
21760
21760
|
}
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
return (proxyURL.href);
|
|
21764
|
-
},
|
|
21761
|
+
return util_1.default.format("http://%s:%s@flow.hailiangip.com:14223", username, password);
|
|
21762
|
+
}
|
|
21765
21763
|
});
|
|
21766
|
-
this.orderNo = "O23113017495247478361"; /* 订单编号 */
|
|
21767
|
-
this.orderPwd = "123456aa.."; /* 订单密码 */
|
|
21768
|
-
this.duplicate = "1"; /* 是否按天去重 - 0:不去重 1:按天去重 */
|
|
21769
|
-
this.switch = "0"; /* 异常自动切换 - 0:自动切换 1:不自动切换,返回代理异常 */
|
|
21770
21764
|
}
|
|
21771
21765
|
}
|
|
21772
21766
|
exports.LiuGuanProxy = LiuGuanProxy;
|