UNPKG

vpn.email.client

Version:
52 lines (51 loc) 1.52 kB
"use strict"; class hostList { constructor(listPool, domainBlackList) { this.listPool = listPool; this.domainBlackList = domainBlackList; } putList(urlData) { const host = urlData.Url.hostname; const data = this.listPool.get(host) || { host: host, security: 0, get: 0, post: 0, other: 0, ipaddress: null, }; if (urlData.isConnect && urlData.Url.port === '443') data.security++; else if (urlData.isGet) data.get++; else if (urlData.isPost) data.post++; else data.other++; this.listPool.set(host, data); const nn = this.domainBlackList.find(n => { return n === data.host; }); return nn && nn.length; } putListSock5(host, urlData) { const data = this.listPool.get(host) || { host: urlData && urlData.Url.hostname ? urlData.Url.hostname : null, ipaddress: host, security: 0, get: 0, post: 0, other: 0 }; if (!urlData) data.security++; else if (urlData.isGet) data.get++; else if (urlData.isPost) data.post++; else data.other++; this.listPool.set(host, data); const nn = this.domainBlackList.find(n => { return n === data.host; }); return nn && nn.length; } } exports.hostList = hostList;