Browse Source

update readme; auto detect config path

1.4
clowwindy 12 years ago
parent
commit
f65aa6b114
  1. 21
      README.md
  2. 4
      local.py
  3. 4
      server.py

21
README.md

@ -6,23 +6,18 @@ shadowsocks is a lightweight tunnel proxy which can help you get through firewal
usage
-----------
Put `server.py` on your server. Edit `server.py`, change the following values:
Edit `config.json`, change the following values:
PORT server port
KEY a password to identify clients
server your server ip or hostname
server_port server port
local_port local port
password a password used to encrypt transfer
Run `python server.py` on your server. To run it in the background, run `nohup python server.py > log &`.
Put all the files on your server. Run `python server.py` on your server. To run it in the background, run `nohup python server.py > log &`.
Put `local.py` on your client machine. Edit `local.py`, change these values:
SERVER your server ip or hostname
REMOTE_PORT server port
PORT local port
KEY a password, it must be the same as the password of your server
Run `python local.py` on your client machine.
Put all the files on your client machine. Run `python local.py` on your client machine.
Change proxy settings of your browser into
SOCKS5 127.0.0.1:PORT
SOCKS5 127.0.0.1:local_port

4
local.py

@ -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.decrypt(remote.recv(4096))) <= 0:
break
finally:
sock.close()
remote.close()
def encrypt(self, data):
@ -115,6 +117,8 @@ class Socks5Server(SocketServer.StreamRequestHandler):
if __name__ == '__main__':
os.chdir(os.path.dirname(__file__) or '.')
with open('config.json', 'rb') as f:
config = json.load(f)
SERVER = config['server']

4
server.py

@ -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']

Loading…
Cancel
Save