ipv6 version

This commit is contained in:
clowwindy 2012-05-10 15:19:24 +08:00
parent 93890e9ccc
commit 7d8005891a
2 changed files with 5 additions and 5 deletions

View file

@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
SERVER = 'myserver_ip_or_hostname' SERVER = '::1'
REMOTE_PORT = 8499 REMOTE_PORT = 8499
PORT = 1080 PORT = 1080
KEY = "foobar!" KEY = "foobar!"
@ -95,11 +95,11 @@ class Socks5Server(SocketServer.StreamRequestHandler):
def handle(self): def handle(self):
try: try:
sock = self.connection sock = self.connection
remote = socket.socket(socket.AF_INET, socket.SOCK_STREAM) remote = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
remote.connect((SERVER, REMOTE_PORT)) remote.connect((SERVER, REMOTE_PORT))
self.handle_tcp(sock, remote) self.handle_tcp(sock, remote)
except socket.error: except socket.error as e:
lock_print('socket error') lock_print('socket error: ' + str(e))
def main(): def main():

View file

@ -42,7 +42,7 @@ def get_table(key):
class ThreadingTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): class ThreadingTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pass address_family = socket.AF_INET6
class Socks5Server(SocketServer.StreamRequestHandler): class Socks5Server(SocketServer.StreamRequestHandler):