This commit is contained in:
parent
46b6b0daf2
commit
d6e507ad7f
1 changed files with 13 additions and 13 deletions
26
server.py
26
server.py
|
@ -759,19 +759,19 @@ def tcp_session(sock):
|
|||
print("Something went wrong...")
|
||||
print(traceback.format_exc())
|
||||
def ssl_session(sock2):
|
||||
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||
context.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
||||
with context.wrap_socket(sock2, server_side=True) as sock:
|
||||
while True:
|
||||
try:
|
||||
while opened:
|
||||
print("Waiting for connection...")
|
||||
connection, client = sock.accept()
|
||||
ip_to = restrict_ip
|
||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to, True]).start()
|
||||
except:
|
||||
print("Something went wrong...")
|
||||
print(traceback.format_exc())
|
||||
while True:
|
||||
try:
|
||||
while opened:
|
||||
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
||||
context.load_cert_chain(ssl_cert, keyfile=ssl_pkey)
|
||||
with context.wrap_socket(sock2, server_side=True) as sock:
|
||||
print("Waiting for connection...")
|
||||
connection, client = sock.accept()
|
||||
ip_to = restrict_ip
|
||||
threading.Thread(target=session, daemon=True, args=[connection, client, ip_to, True]).start()
|
||||
except:
|
||||
print("Something went wrong...")
|
||||
print(traceback.format_exc())
|
||||
for ip, i in sockets.items():
|
||||
print("Now listening on port 6667 with IP " + ip)
|
||||
threading.Thread(target=tcp_session, args=[i], daemon=True).start()
|
||||
|
|
Loading…
Add table
Reference in a new issue