Monthly Archives: October 2014

Weighted Round Robin In Nodejs

Round-robin (RR) is one of the algorithms employed by schedulers in computing. Jobs are assigned to each worker in circular order, It’s simple but useful.

I have a web server writing by node just for front-end display, APIs are most holding by back-end servers. So I have 2 functions supporting my structure. The first is health check helping me check whether the back-end server is ready; and the other one is round robin scheduling, to ensure an even distribution.
Continue reading

GFW拦截socks5诡异的规则

GFW会拦截socks5明文的包,今天发现一个诡异的现象,就是有些包虽然含有一些敏感词,譬如google.com还是能通过,所以就跟了一下,发现和初始化socks5有关。
初始化socks5连接的时候客户端会发送一个“我能接受何种验证的包”,格式大概为
05 02 00 02
05意思为socks5版本,02支持两种验证格式,后两位就是两种验证格式,所有的验证格式如下

  1. 0x00: No authentication
  2. 0x01: GSSAPI[12]
  3. 0x02: Username/Password[13]
  4. 0x03–0x7F: methods assigned by IANA[14]
  5. 0x80–0xFE: methods reserved for private use

如果支持的验证方式包含GSSAPI,即便最终的交互没有用到这种方式,那么后续正文内容的包就不会被扫描拦截。
也就是如果一旦是
05 03 00 01 02
GFW就休息了。
煞是奇怪。起码最近是这样。所以为了自由一点,所以还是stunnel吧