Revert "Reformat project"

This reverts commit 64e3e1160aa76d191740342ab3edc68807f890fb.
This commit is contained in:
2022-07-21 13:40:01 +01:00
parent 760e43b59a
commit 3229d9b806
57 changed files with 214 additions and 519 deletions

View File

@@ -1,7 +1,6 @@
from copy import deepcopy
from twisted.internet.protocol import Protocol, Factory, ClientFactory
from json import dumps, loads
from twisted.internet.protocol import ClientFactory, Factory, Protocol
from copy import deepcopy
import main
from utils.logging.log import *
@@ -115,13 +114,8 @@ class Relay(Protocol):
def handleHello(self, parsed):
if parsed["key"] in main.tokens.keys():
if (
parsed["hello"] == main.tokens[parsed["key"]]["hello"]
and main.tokens[parsed["key"]]["usage"] == "relay"
):
self.sendMsg(
{"type": "hello", "hello": main.tokens[parsed["key"]]["counter"]}
)
if parsed["hello"] == main.tokens[parsed["key"]]["hello"] and main.tokens[parsed["key"]]["usage"] == "relay":
self.sendMsg({"type": "hello", "hello": main.tokens[parsed["key"]]["counter"]})
self.authed = True
else:
self.transport.loseConnection()
@@ -136,10 +130,7 @@ class Relay(Protocol):
def connectionLost(self, reason):
self.authed = False
log(
"Relay connection lost from %s:%s -- %s"
% (self.addr.host, self.addr.port, reason.getErrorMessage())
)
log("Relay connection lost from %s:%s -- %s" % (self.addr.host, self.addr.port, reason.getErrorMessage()))
if self.addr in main.relayConnections.keys():
del main.relayConnections[self.addr]
else: