update readme; auto detect config path

This commit is contained in:
clowwindy 2012-11-02 17:36:57 +08:00
parent 2f67cabfe0
commit f65aa6b114
3 changed files with 16 additions and 13 deletions

View file

@ -28,6 +28,7 @@ import struct
import string
import hashlib
import sys
import os
import json
import logging
@ -59,6 +60,7 @@ class Socks5Server(SocketServer.StreamRequestHandler):
if sock.send(self.encrypt(remote.recv(4096))) <= 0:
break
finally:
sock.close()
remote.close()
def encrypt(self, data):
@ -94,6 +96,8 @@ class Socks5Server(SocketServer.StreamRequestHandler):
logging.warn('socket error ' + str(e))
if __name__ == '__main__':
os.chdir(os.path.dirname(__file__) or '.')
with open('config.json', 'rb') as f:
config = json.load(f)
SERVER = config['server']