updating
This commit is contained in:
parent
0c9d2d41a4
commit
12f4176fca
|
@ -9,7 +9,7 @@ from logging import config
|
||||||
|
|
||||||
BUFFER_SIZE = 32 * 1024
|
BUFFER_SIZE = 32 * 1024
|
||||||
CURRENT_THREADS = 0
|
CURRENT_THREADS = 0
|
||||||
MAX_THREADS = 10
|
MAX_THREADS = 50
|
||||||
BACKLOG = 50
|
BACKLOG = 50
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
|
@ -86,20 +86,14 @@ class Server:
|
||||||
self.thread_check()
|
self.thread_check()
|
||||||
|
|
||||||
CURRENT_THREADS += 1
|
CURRENT_THREADS += 1
|
||||||
thread = Thread(target = connectionHandle, args = (conn, client_addr, ))
|
thread = Thread(target = self.handle_connection, args = (conn, client_addr, ))
|
||||||
CURRENT_THREADS -= 1
|
CURRENT_THREADS -= 1
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
|
||||||
def is_valid_status_code(status_code:str):
|
def handle_connection(self, client_socket, client_address):
|
||||||
valid_starts = [str(i) for i in range(5)]
|
|
||||||
if status_code.startswith(tuple(valid_starts)):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def connectionHandle(client_socket, client_address):
|
|
||||||
request = client_socket.recv(BUFFER_SIZE)
|
request = client_socket.recv(BUFFER_SIZE)
|
||||||
logger = Logger.instance()
|
logger = Logger.instance()
|
||||||
|
|
||||||
|
@ -177,9 +171,14 @@ def connectionHandle(client_socket, client_address):
|
||||||
server_socket.close()
|
server_socket.close()
|
||||||
client_socket.close()
|
client_socket.close()
|
||||||
|
|
||||||
def verify_code_integrity():
|
def is_valid_status_code(status_code: str):
|
||||||
|
valid_starts = [str(i) for i in range(5)]
|
||||||
|
if status_code.startswith(tuple(valid_starts)):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def check_code():
|
||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
|
||||||
|
|
||||||
content = None
|
content = None
|
||||||
shas256_hash = None
|
shas256_hash = None
|
||||||
|
@ -199,7 +198,7 @@ def verify_code_integrity():
|
||||||
print('Arquivo do proxy verificado!')
|
print('Arquivo do proxy verificado!')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
verify_code_integrity()
|
check_code()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ser = Server(host="0.0.0.0", port=8080)
|
ser = Server(host="0.0.0.0", port=8080)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
dd8f33d81858978c4fec0eb3c2f0acb768028a10d80428417aae91bf86b343d3
|
02c9fe27bfc80f2a71e6a7b618c379fcd60b18c4e8cc646d081b1eebb7682bba
|
Loading…
Reference in New Issue