找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 20|回复: 3

现在 ss 配置用的白名单,但是却完全上不了 Telegram 求带

[复制链接]

40

主题

33

回帖

202

积分

中级会员

积分
202
发表于 2016-8-25 18:33:53 | 显示全部楼层 |阅读模式
ss 白名单用的是 https://github.com/breakwa11/高墙_whitelist 的,理论上用的是白名单,除了一些国内网站别的都走代理,为啥 Telegram 还会上不去呢 ...... 上去一直 连接中

主干部分如下(去掉了几千行的名单),求大神分析:
var wall_proxy = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080;";
var nowall_proxy = "DIRECT;";
var direct = "DIRECT;";
var ip_proxy = "DIRECT;";

var white_domains = {"am":{
"126":1,
"hexun.com":1,
"taiwandao":1
},"us":{
"pangu":1
},"ws":{
"0798":1
},"xn--fiqs8s":{
"":1
}
};

var subnetIpRangeList = [
0,1,
167772160,184549376,  //10.0.0.0/8
2886729728,2887778304,  //172.16.0.0/12
3232235520,3232301056,  //192.168.0.0/16
2130706432,2130706688 //127.0.0.0/24
];

var hasOwnProperty = Object.hasOwnProperty;

function check_ipv4(host) {
  // check if the ipv4 format (TODO: ipv6)
  //   http://home.deds.nl/~aeron/regex/
  var re_ipv4 = /^\d+\.\d+\.\d+\.\d+$/g;
  if (re_ipv4.test(host)) {
    // in theory, we can add chnroutes test here.
    // but that is probably too much an overkill.
    return true;
  }
}
function convertAddress(ipchars) {
  var bytes = ipchars.split('.');
  var result = (bytes[0] >> 0;
}
function isInSubnetRange(ipRange, intIp) {
  for ( var i = 0; i < 10; i += 2 ) {
    if ( ipRange[i] <= intIp && intIp < ipRange[i+1] )
      return true;
  }
}
function getProxyFromDirectIP(strIp) {
  var intIp = convertAddress(strIp);
  if ( isInSubnetRange(subnetIpRangeList, intIp) ) {
    return direct;
  }
  return ip_proxy;
}
function isInDomains(domain_dict, host) {
  var suffix;
  var pos1 = host.lastIndexOf('.');

  suffix = host.substring(pos1 + 1);
  if (suffix == "cn") {
    return true;
  }

  var domains = domain_dict[suffix];
  if ( domains === undefined ) {
    return false;
  }
  host = host.substring(0, pos1);
  var pos = host.lastIndexOf('.');

  while(1) {
    if (pos <= 0) {
      if (hasOwnProperty.call(domains, host)) {
        return true;
      } else {
        return false;
      }
    }
    suffix = host.substring(pos + 1);
    if (hasOwnProperty.call(domains, suffix)) {
      return true;
    }
    pos = host.lastIndexOf('.', pos - 1);
  }
}
function FindProxyForURL(url, host) {
  if ( isPlainHostName(host) === true ) {
    return direct;
  }
  if ( check_ipv4(host) === true ) {
    return getProxyFromDirectIP(host);
  }
  if ( isInDomains(white_domains, host) === true ) {
    return nowall_proxy;
  }
  return wall_proxy;
}

回复

使用道具 举报

4

主题

76

回帖

166

积分

注册会员

积分
166
发表于 2016-8-25 18:35:16 | 显示全部楼层
直接开全局多方便

回复

使用道具 举报

331

主题

3490

回帖

8051

积分

论坛元老

积分
8051
发表于 2016-8-26 00:54:19 | 显示全部楼层




这样不就行了。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

1

主题

24

回帖

63

积分

注册会员

积分
63
发表于 2016-8-26 01:09:16 | 显示全部楼层
SOCKS5代理  127.0.0.1不就行了嘛
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Discuz! X

GMT+8, 2025-2-5 10:50 , Processed in 0.017119 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表