mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
Introduce full asyncio version (still some module to migrate). Defender JSONRPC Server ready and using with uvcorn
This commit is contained in:
@@ -4,30 +4,29 @@ from .inspircd import Inspircd
|
||||
from ..interfaces.iprotocol import IProtocol
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.irc import Irc
|
||||
from core.loader import Loader
|
||||
|
||||
class ProtocolFactorty:
|
||||
|
||||
def __init__(self, uplink: 'Irc'):
|
||||
def __init__(self, context: 'Loader'):
|
||||
"""ProtocolFactory init.
|
||||
|
||||
Args:
|
||||
uplink (Irc): The Irc object
|
||||
context (Loader): The Context object
|
||||
"""
|
||||
self.__Config = uplink.Config
|
||||
self.__uplink = uplink
|
||||
self.__ctx = context
|
||||
|
||||
def get(self) -> Optional[IProtocol]:
|
||||
|
||||
protocol = self.__Config.SERVEUR_PROTOCOL
|
||||
protocol = self.__ctx.Config.SERVEUR_PROTOCOL
|
||||
|
||||
match protocol:
|
||||
case 'unreal6':
|
||||
self.__uplink.Logs.debug(f"[PROTOCOL] {protocol} has been loaded")
|
||||
return Unrealircd6(self.__uplink)
|
||||
self.__ctx.Logs.debug(f"[PROTOCOL] {protocol} has been loaded")
|
||||
return Unrealircd6(self.__ctx)
|
||||
case 'inspircd':
|
||||
self.__uplink.Logs.debug(f"[PROTOCOL] {protocol} has been loaded")
|
||||
return Inspircd(self.__uplink)
|
||||
self.__ctx.Logs.debug(f"[PROTOCOL] {protocol} has been loaded")
|
||||
return Inspircd(self.__ctx)
|
||||
case _:
|
||||
self.__uplink.Logs.critical(f"[PROTOCOL ERROR] This protocol name ({protocol} is not valid!)")
|
||||
self.__ctx.Logs.critical(f"[PROTOCOL ERROR] This protocol name ({protocol} is not valid!)")
|
||||
raise Exception("Unknown protocol!")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user