oicq-icalingua-plus-plus 1.22.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.
Files changed (50) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +73 -0
  3. package/bin/oicq +2 -0
  4. package/http-api/README.md +187 -0
  5. package/http-api/api.js +217 -0
  6. package/http-api/config.sample.js +44 -0
  7. package/http-api/core.js +480 -0
  8. package/http-api/cq-notice.js +39 -0
  9. package/http-api/filter.js +128 -0
  10. package/http-api/index.js +39 -0
  11. package/index.d.ts +1214 -0
  12. package/index.js +34 -0
  13. package/lib/algo/jce/index.js +63 -0
  14. package/lib/algo/jce/jce.js +341 -0
  15. package/lib/algo/pb.js +159 -0
  16. package/lib/algo/protobuf.min.js +8 -0
  17. package/lib/algo/tea.js +121 -0
  18. package/lib/client-ext.js +312 -0
  19. package/lib/client-net.js +147 -0
  20. package/lib/client.js +594 -0
  21. package/lib/common.js +252 -0
  22. package/lib/core/friendlist.js +415 -0
  23. package/lib/core/nessy.js +148 -0
  24. package/lib/core/ref.d.ts +1 -0
  25. package/lib/core/sysmsg.js +388 -0
  26. package/lib/core/troop.js +586 -0
  27. package/lib/device.js +181 -0
  28. package/lib/exception.js +57 -0
  29. package/lib/message/builder.js +1093 -0
  30. package/lib/message/chat.js +276 -0
  31. package/lib/message/face.js +293 -0
  32. package/lib/message/file.js +425 -0
  33. package/lib/message/history.js +73 -0
  34. package/lib/message/image.js +533 -0
  35. package/lib/message/multi.js +242 -0
  36. package/lib/message/music.js +172 -0
  37. package/lib/message/parser.js +774 -0
  38. package/lib/message/ptt.js +389 -0
  39. package/lib/oicq.js +427 -0
  40. package/lib/onlinepush.js +616 -0
  41. package/lib/ref.d.ts +177 -0
  42. package/lib/service.js +204 -0
  43. package/lib/wtlogin/ecdh.js +15 -0
  44. package/lib/wtlogin/login-password.js +215 -0
  45. package/lib/wtlogin/login-qrcode.js +249 -0
  46. package/lib/wtlogin/tlv.js +331 -0
  47. package/lib/wtlogin/writer.js +88 -0
  48. package/lib/wtlogin/wt.js +422 -0
  49. package/package.json +50 -0
  50. package/util.js +115 -0
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ const BUF7 = Buffer.alloc(7);
4
+ const table = [
5
+ 0x9e3779b9,
6
+ 0x3c6ef372,
7
+ 0xdaa66d2b,
8
+ 0x78dde6e4,
9
+ 0x1715609d,
10
+ 0xb54cda56,
11
+ 0x5384540f,
12
+ 0xf1bbcdc8,
13
+ 0x8ff34781,
14
+ 0x2e2ac13a,
15
+ 0xcc623af3,
16
+ 0x6a99b4ac,
17
+ 0x08d12e65,
18
+ 0xa708a81e,
19
+ 0x454021d7,
20
+ 0xe3779b90,
21
+ ];
22
+
23
+ function _toUInt32(num) {
24
+ return num >>> 0;
25
+ }
26
+
27
+ function _encrypt(x, y, k0, k1, k2, k3) {
28
+ for (let i = 0; i < 16; ++i) {
29
+ let aa = (_toUInt32((y << 4 >>> 0) + k0) ^ _toUInt32(y + table[i])) >>> 0 ^ _toUInt32(~~(y / 32) + k1);
30
+ aa >>>= 0;
31
+ x = _toUInt32(x + aa);
32
+ let bb = (_toUInt32((x << 4 >>> 0) + k2) ^ _toUInt32(x + table[i])) >>> 0 ^ _toUInt32(~~(x / 32) + k3);
33
+ bb >>>= 0;
34
+ y = _toUInt32(y + bb);
35
+ }
36
+ return [x, y];
37
+ }
38
+
39
+ /**
40
+ * qqtea encrypt
41
+ * @param {Buffer} data
42
+ * @param {Buffer} key length = 16
43
+ */
44
+ function encrypt(data, key) {
45
+ let n = 6 - data.length >>> 0;
46
+ n = n % 8 + 2;
47
+ const v = Buffer.concat([
48
+ Buffer.from([(n - 2) | 0xF8]),
49
+ Buffer.allocUnsafe(n),
50
+ data,
51
+ BUF7
52
+ ]);
53
+ const k0 = key.readUInt32BE(0);
54
+ const k1 = key.readUInt32BE(4);
55
+ const k2 = key.readUInt32BE(8);
56
+ const k3 = key.readUInt32BE(12);
57
+ let r1 = 0, r2 = 0, t1 = 0, t2 = 0;
58
+ for (let i = 0; i < v.length; i += 8) {
59
+ const a1 = v.readUInt32BE(i);
60
+ const a2 = v.readUInt32BE(i + 4);
61
+ const b1 = a1 ^ r1;
62
+ const b2 = a2 ^ r2;
63
+ const [x, y] = _encrypt(b1 >>> 0, b2 >>> 0, k0, k1, k2, k3);
64
+ r1 = x ^ t1;
65
+ r2 = y ^ t2;
66
+ t1 = b1;
67
+ t2 = b2;
68
+ v.writeInt32BE(r1, i);
69
+ v.writeInt32BE(r2, i + 4);
70
+ }
71
+ return v;
72
+ }
73
+
74
+ function _decrypt(x, y, k0, k1, k2, k3) {
75
+ for (let i = 15; i >= 0; --i) {
76
+ let aa = (_toUInt32((x << 4 >>> 0) + k2) ^ _toUInt32(x + table[i])) >>> 0 ^ _toUInt32(~~(x / 32) + k3);
77
+ y = y - aa >>> 0;
78
+ let bb = (_toUInt32((y << 4 >>> 0) + k0) ^ _toUInt32(y + table[i])) >>> 0 ^ _toUInt32(~~(y / 32) + k1);
79
+ x = x - bb >>> 0;
80
+ }
81
+ return [x, y];
82
+ }
83
+
84
+ /**
85
+ * qqtea decrypt
86
+ * @param {Buffer} encrypted
87
+ * @param {Buffer} key length = 16
88
+ */
89
+ function decrypt(encrypted, key) {
90
+ if (encrypted.length % 8) {
91
+ throw new Error("length of encrypted data must be a multiple of 8");
92
+ }
93
+ const k0 = key.readUInt32BE(0);
94
+ const k1 = key.readUInt32BE(4);
95
+ const k2 = key.readUInt32BE(8);
96
+ const k3 = key.readUInt32BE(12);
97
+ let r1 = 0, r2 = 0, t1 = 0, t2 = 0, x = 0, y = 0;
98
+ for (let i = 0; i < encrypted.length; i += 8) {
99
+ const a1 = encrypted.readUInt32BE(i);
100
+ const a2 = encrypted.readUInt32BE(i + 4);
101
+ const b1 = a1 ^ x;
102
+ const b2 = a2 ^ y;
103
+ [x, y] = _decrypt(b1 >>> 0, b2 >>> 0, k0, k1, k2, k3);
104
+ r1 = x ^ t1;
105
+ r2 = y ^ t2;
106
+ t1 = a1;
107
+ t2 = a2;
108
+ encrypted.writeInt32BE(r1, i);
109
+ encrypted.writeInt32BE(r2, i + 4);
110
+ }
111
+ if (Buffer.compare(encrypted.slice(encrypted.length - 7), BUF7) !== 0)
112
+ throw new Error("encrypted data is illegal");
113
+ return encrypted.slice(
114
+ (encrypted[0] & 0x07) + 3,
115
+ encrypted.length - 7
116
+ );
117
+ }
118
+
119
+ module.exports = {
120
+ encrypt, decrypt
121
+ };
@@ -0,0 +1,312 @@
1
+ /**
2
+ * 扩展Client类
3
+ */
4
+ "use strict";
5
+
6
+ const { randomBytes } = require("crypto");
7
+ const { Client } = require("./client");
8
+ const tea = require("./algo/tea");
9
+ const pb = require("./algo/pb");
10
+ const { timestamp, uin2code, BUF16, log } = require("./common");
11
+ const { TimeoutError } = require("./exception");
12
+ const { parseC2CMsg } = require("./message/parser");
13
+
14
+ /**
15
+ * seqid递增并返回
16
+ */
17
+ Client.prototype.nextSeq = function() {
18
+ if (++this.seq_id >= 0x8000)
19
+ this.seq_id = 1;
20
+ return this.seq_id;
21
+ };
22
+
23
+ const ERROR_TIMEOUT = new TimeoutError("package timeout");
24
+
25
+ /**
26
+ * 发送一个包并返回响应包
27
+ */
28
+ Client.prototype.send = function (packet, timeout = 5) {
29
+ ++this.stat.sent_pkt_cnt;
30
+ const seq_id = this.seq_id;
31
+ return new Promise((resolve, reject) => {
32
+ this._socket.write(packet, () => {
33
+ const id = setTimeout(() => {
34
+ this.handlers.delete(seq_id);
35
+ ++this.stat.lost_pkt_cnt;
36
+ reject(ERROR_TIMEOUT);
37
+ }, timeout * 1000);
38
+ this.handlers.set(seq_id, (data) => {
39
+ clearTimeout(id);
40
+ this.handlers.delete(seq_id);
41
+ resolve(data);
42
+ });
43
+ });
44
+ });
45
+ };
46
+
47
+ /**
48
+ * 发送一个uni包
49
+ * 除login包之外都是uni包,以0x0b开头
50
+ * login包以0x0a开头
51
+ */
52
+ Client.prototype.writeUni = function (cmd, body, seq = 0) {
53
+ ++this.stat.sent_pkt_cnt;
54
+ this._socket.write(this._buildUniPacket(cmd, body, seq));
55
+ };
56
+
57
+ /**
58
+ * 发送一个uni包并返回响应包
59
+ */
60
+ Client.prototype.sendUni = function (cmd, body, timeout = 5) {
61
+ return this.send(this._buildUniPacket(cmd, body), timeout);
62
+ };
63
+
64
+ /**
65
+ * 发送一个oidb包并返回响应包
66
+ * 是uni包的一个封装
67
+ */
68
+ Client.prototype.sendOidb = function (cmd, body) {
69
+ const sp = cmd //OidbSvc.0x568_22
70
+ .replace("OidbSvc.", "")
71
+ .replace("oidb_", "")
72
+ .split("_");
73
+ const type1 = parseInt(sp[0], 16),
74
+ type2 = parseInt(sp[1]);
75
+ body = pb.encode({
76
+ 1: type1,
77
+ 2: isNaN(type2) ? 1 : type2,
78
+ 3: 0,
79
+ 4: body,
80
+ 6: "android " + this.apk.ver,
81
+ });
82
+ return this.sendUni(cmd, body);
83
+ };
84
+
85
+ /**
86
+ * 构造一个uni包
87
+ * @param {string} cmd
88
+ * @param {Buffer} body
89
+ */
90
+ Client.prototype._buildUniPacket = function (cmd, body, seq = 0) {
91
+ seq = seq ? seq : this.nextSeq();
92
+ this.logger.trace(`send:${cmd} seq:${seq}`);
93
+ const type = cmd === "wtlogin.exchange_emp" ? 2 : 1;
94
+
95
+ let len = cmd.length + 20;
96
+ const sso = Buffer.allocUnsafe(len + body.length + 4);
97
+ sso.writeUInt32BE(len, 0);
98
+ sso.writeUInt32BE(cmd.length + 4, 4);
99
+ sso.fill(cmd, 8);
100
+ let offset = cmd.length + 8;
101
+ sso.writeUInt32BE(8, offset);
102
+ sso.fill(this._wt.session_id, offset + 4);
103
+ sso.writeUInt32BE(4, offset + 8);
104
+ sso.writeUInt32BE(body.length + 4, offset + 12);
105
+ sso.fill(body, offset + 16);
106
+
107
+ const encrypted = tea.encrypt(sso, type === 1 ? this.sig.d2key : BUF16);
108
+ const uin = String(this.uin);
109
+ len = encrypted.length + uin.length + 18;
110
+ const pkt = Buffer.allocUnsafe(len);
111
+ pkt.writeUInt32BE(len, 0);
112
+ pkt.writeUInt32BE(0x0B, 4);
113
+ pkt.writeUInt8(type, 8);
114
+ pkt.writeInt32BE(seq, 9);
115
+ pkt.writeUInt8(0, 13);
116
+ pkt.writeUInt32BE(uin.length + 4, 14);
117
+ pkt.fill(uin, 18);
118
+ pkt.fill(encrypted, uin.length + 18);
119
+ return pkt;
120
+ }
121
+
122
+ /**
123
+ * 构造事件共通属性
124
+ */
125
+ Client.prototype.parseEventType = function (name = "") {
126
+ const slice = name.split(".");
127
+ const post_type = slice[0], sub_type = slice[2];
128
+ const data = {
129
+ self_id: this.uin,
130
+ time: timestamp(),
131
+ post_type: post_type,
132
+ };
133
+ const type_name = slice[0] + "_type";
134
+ data[type_name] = slice[1];
135
+ if (sub_type)
136
+ data.sub_type = sub_type;
137
+ return data;
138
+ };
139
+
140
+ /**
141
+ * 触发事件
142
+ */
143
+ Client.prototype.em = function (name = "", data = {}) {
144
+ data = Object.assign(this.parseEventType(name), data);
145
+ while (true) {
146
+ this.emit(name, data);
147
+ let i = name.lastIndexOf(".");
148
+ if (i === -1)
149
+ break;
150
+ name = name.slice(0, i);
151
+ }
152
+ };
153
+
154
+ /**
155
+ * 用于消息去重和数据统计
156
+ */
157
+ Client.prototype.msgExists = function (from, type, seq, time) {
158
+ if (timestamp() - time >= 60 || time < this.stat.start_time)
159
+ return true;
160
+ const id = [from, type, seq].join("-");
161
+ const set = this.seq_cache.get(time);
162
+ if (!set) {
163
+ this.seq_cache.set(time, new Set([id]));
164
+ return false;
165
+ } else {
166
+ if (set.has(id))
167
+ return true;
168
+ else
169
+ set.add(id);
170
+ return false;
171
+ }
172
+ };
173
+
174
+ /**
175
+ * 构造私聊消息cookie
176
+ */
177
+ Client.prototype.buildSyncCookie = function () {
178
+ const time = timestamp();
179
+ return pb.encode({
180
+ 1: time,
181
+ 2: time,
182
+ 3: this.const1,
183
+ 4: this.const2,
184
+ 5: randomBytes(4).readUInt32BE(),
185
+ 9: randomBytes(4).readUInt32BE(),
186
+ 11: randomBytes(4).readUInt32BE(),
187
+ 12: this.const3,
188
+ 13: time,
189
+ 14: 0,
190
+ });
191
+ };
192
+
193
+ /**
194
+ * 消息同步
195
+ */
196
+ Client.prototype.pbGetMsg = async function () {
197
+ if (!this.sync_cookie)
198
+ this.sync_cookie = this.buildSyncCookie();
199
+ let body = pb.encode({
200
+ 1: 0,
201
+ 2: this.sync_cookie,
202
+ 3: 0,
203
+ 4: 20,
204
+ 5: 3,
205
+ 6: 1,
206
+ 7: 1,
207
+ 9: 1,
208
+ });
209
+ try {
210
+ const blob = await this.sendUni("MessageSvc.PbGetMsg", body);
211
+ const rsp = pb.decode(blob);
212
+ if (rsp[3])
213
+ this.sync_cookie = rsp[3].toBuffer();
214
+ if (rsp[1] > 0 || !rsp[5])
215
+ return true;
216
+ const items = [];
217
+ if (!Array.isArray(rsp[5]))
218
+ rsp[5] = [rsp[5]];
219
+ for (let v of rsp[5]) {
220
+ if (!v[4]) continue;
221
+ if (!Array.isArray(v[4]))
222
+ v[4] = [v[4]];
223
+ for (let msg of v[4]) {
224
+ const head = msg[1];
225
+ const type = head[3];
226
+ const item = { ...head };
227
+ item[3] = 187;
228
+ items.push(item);
229
+ if (!this.sync_finished)
230
+ continue;
231
+ let from_uin = head[1], to_uin = head[2];
232
+ if (from_uin === this.uin && from_uin !== to_uin)
233
+ continue;
234
+ if (![33, 38, 85, 141, 166, 167, 208, 529].includes(type))
235
+ continue;
236
+ if (this.msgExists(from_uin, type, head[5], head[6]))
237
+ continue;
238
+
239
+ //群员入群
240
+ if (type === 33) {
241
+ (async () => {
242
+ const group_id = uin2code(from_uin);
243
+ const user_id = head[15];
244
+ const nickname = String(head[16]);
245
+ const ginfo = (await this.getGroupInfo(group_id)).data;
246
+ if (!ginfo) return;
247
+ if (user_id === this.uin) {
248
+ this.logger.info(`更新了群列表,新增了群:${group_id}`);
249
+ this.getGroupMemberList(group_id);
250
+ } else {
251
+ ginfo.member_count++;
252
+ ginfo.last_join_time = timestamp();
253
+ await this.getGroupMemberInfo(group_id, user_id);
254
+ try {
255
+ if (this.gml.get(group_id).size)
256
+ ginfo.member_count = this.gml.get(group_id).size;
257
+ } catch { }
258
+ this.logger.info(`${user_id}(${nickname}) 加入了群 ${group_id}`);
259
+ }
260
+ this.em("notice.group.increase", {
261
+ group_id, user_id, nickname
262
+ });
263
+ })();
264
+ }
265
+
266
+ //被管理批准入群,建群
267
+ else if (type === 85 || type === 38) {
268
+ (async () => {
269
+ const group_id = uin2code(from_uin);
270
+ const user_id = this.uin;
271
+ const nickname = this.nickname;
272
+ const ginfo = (await this.getGroupInfo(group_id)).data;
273
+ if (!ginfo) return;
274
+ if (user_id === this.uin) {
275
+ this.logger.info(`更新了群列表,新增了群:${group_id}`);
276
+ this.getGroupMemberList(group_id);
277
+ }
278
+ this.em("notice.group.increase", {
279
+ group_id, user_id, nickname
280
+ });
281
+ })();
282
+ }
283
+
284
+ //私聊消息
285
+ else {
286
+ ++this.stat.recv_msg_cnt;
287
+ (async () => {
288
+ try {
289
+ const data = await parseC2CMsg.call(this, msg, true);
290
+ if (data && data.raw_message) {
291
+ data.reply = (message, auto_escape = false) => this.sendPrivateMsg(data.user_id, message, auto_escape);
292
+ this.logger.info(`recv from: [Private: ${data.user_id}(${data.sub_type})] ` + data.raw_message);
293
+ this.em("message.private." + data.sub_type, data);
294
+ }
295
+ } catch (e) {
296
+ this.logger.debug(e);
297
+ }
298
+ })();
299
+ }
300
+ }
301
+ }
302
+
303
+ if (items.length) {
304
+ this.writeUni("MessageSvc.PbDeleteMsg", pb.encode({ 1: items }));
305
+ }
306
+ return true;
307
+ } catch (e) {
308
+ this.logger.debug("getMsg发生错误。");
309
+ this.logger.debug(e);
310
+ return false;
311
+ }
312
+ };
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ const net = require("net");
3
+ const https = require("https");
4
+ const { BUF0, timestamp } = require("./common");
5
+ const tea = require("./algo/tea");
6
+ const jce = require("./algo/jce");
7
+
8
+ const default_host = "msfwifi.3g.qq.com";
9
+ const default_port = 8080;
10
+ let update_time = 0;
11
+ let host_port = { };
12
+
13
+ class Network extends net.Socket {
14
+
15
+ closed_time = timestamp();
16
+ host = default_host;
17
+ port = default_port;
18
+ _data = BUF0;
19
+
20
+ /**
21
+ * @param {import("./ref").Client} c
22
+ */
23
+ constructor(c) {
24
+ super();
25
+ this.c = c;
26
+
27
+ this.on("error", (err) => {
28
+ this.c.logger.error(err.message);
29
+ });
30
+
31
+ this.on("close", () => {
32
+ this._data = BUF0;
33
+ if (this.remoteAddress)
34
+ this.c.logger.mark(`${this.remoteAddress}:${this.remotePort} closed`);
35
+ if (timestamp() - this.closed_time <= 300)
36
+ delete host_port[this.host];
37
+ this.closed_time = timestamp();
38
+ this.c.emit("internal.offline");
39
+ this.c.emit("internal.logout");
40
+ });
41
+
42
+ this.on("data", (data) => {
43
+ this._data = this._data.length === 0 ? data : Buffer.concat([this._data, data]);
44
+ while (this._data.length > 4) {
45
+ let len = this._data.readUInt32BE();
46
+ if (this._data.length >= len) {
47
+ const packet = this._data.slice(4, len);
48
+ this._data = this._data.slice(len);
49
+ this.c.emit("internal.packet", packet);
50
+ } else {
51
+ break;
52
+ }
53
+ }
54
+ });
55
+ }
56
+
57
+ async join(cb) {
58
+ if (timestamp() - this.closed_time > 300) {
59
+ //
60
+ } else if (net.isIP(this.c.config.remote_ip)) {
61
+ this.host = this.c.config.remote_ip;
62
+ this.port = 8080;
63
+ if (this.c.config.remote_port > 0 && this.c.config.remote_port < 65536)
64
+ this.host = this.c.config.remote_port;
65
+ } else if (this.c.config.auto_server) {
66
+ if (!Object.keys(host_port).length || timestamp() - update_time >= 3600) {
67
+ this.c.logger.mark("正在探索可用服务器...");
68
+ try {
69
+ await this._queryServerList();
70
+ this.host = Object.keys(host_port)[0];
71
+ this.port = host_port[this.host];
72
+ } catch (err) {
73
+ this.c.logger.warn("探索服务器失败: " + (err ? err.message : "timeout"));
74
+ }
75
+ } else {
76
+ this.host = Object.keys(host_port)[0];
77
+ this.port = host_port[this.host];
78
+ }
79
+ }
80
+ this.c.logger.mark(`connecting to ${this.host}:${this.port}`);
81
+ this.removeAllListeners("connect");
82
+ this.connect(this.port, this.host, () => {
83
+ this.c.logger.mark(`${this.remoteAddress}:${this.remotePort} connected`);
84
+ cb();
85
+ });
86
+ }
87
+
88
+ async _queryServerList() {
89
+ const key = Buffer.from("F0441F5FF42DA58FDCF7949ABA62D411", "hex");
90
+ const HttpServerListReq = jce.encodeStruct([
91
+ null,
92
+ 0, 0, 1, "00000", 100, this.c.apk.subid, this.c.device.imei, 0, 0, 0,
93
+ 0, 0, 0, 1
94
+ ]);
95
+ const extra = {
96
+ service: "ConfigHttp",
97
+ method: "HttpServerListReq",
98
+ };
99
+ let body = jce.encodeWrapper({ HttpServerListReq }, extra);
100
+ const len = Buffer.alloc(4);
101
+ len.writeUInt32BE(body.length + 4);
102
+ body = Buffer.concat([len, body]);
103
+ body = tea.encrypt(body, key);
104
+ return await new Promise((resolve, reject) => {
105
+ const id = setTimeout(reject, 5000);
106
+ https.request("https://configsvr.msf.3g.qq.com/configsvr/serverlist.jsp", { method: "POST" }, (res) => {
107
+ let data = [];
108
+ res.on("error", reject);
109
+ res.on("data", (chunk) => data.push(chunk));
110
+ res.on("end", () => {
111
+ try {
112
+ clearTimeout(id);
113
+ data = Buffer.concat(data);
114
+ data = tea.decrypt(data, key).slice(4);
115
+ const nested = jce.decode(data);
116
+ host_port = { };
117
+ for (let v of nested[2]) {
118
+ if (Object.keys(host_port).length >= 3)
119
+ continue;
120
+ host_port[v[1]] = v[2];
121
+ }
122
+ if (Object.keys(host_port).length > 0) {
123
+ update_time = timestamp();
124
+ this.c.logger.debug(host_port);
125
+ resolve();
126
+ } else {
127
+ reject(new Error("no aliveable server"));
128
+ }
129
+ } catch (err) {
130
+ reject(err);
131
+ }
132
+ });
133
+ }).on("error", reject).end(body);
134
+ });
135
+ }
136
+ }
137
+
138
+ module.exports = Network;
139
+
140
+ /**
141
+ * 关于探索服务器:
142
+ * 由于tx服务器偶尔会抽风,若固定使用域名msfwifi.3g.qq.com连接,遇到抽风的IP会炸
143
+ * 探索服务器每次获得3个理论最优IP,一小时内只进行一次探索,除非IP已经用完
144
+ * 在连接后5分钟内若出现断线,则判断此IP抽风,将其排除
145
+ * 5分钟之外的断线则正常重连
146
+ * 同一线程中的所有客户端实例共用一个IP池
147
+ */