4 from threading
import *
9 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
10 print(
'Socket created')
19 print(
'Socket bind complete')
23 print(
'Socket now listening')
26 def forward_to_ssr(request):
30 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
31 s.connect((HOST, PORT))
33 print(
'Connected with ' + addr[0] +
':' + str(addr[1]))
34 print(
'forwarding'+str(request))
47 def clientthread(conn):
57 data = conn.recv(1024)
62 reply = forward_to_ssr(request)
70 conn, addr = s.accept()
71 print(
'Connected with ' + addr[0] +
':' + str(addr[1]))
74 t = threading.Thread(target=clientthread,args=(conn,))