chuni: add matching config, stun turn stuff

This commit is contained in:
2024-01-08 18:22:09 -05:00
parent 343424e26a
commit 27bf51f9f8
3 changed files with 51 additions and 7 deletions

View File

@ -89,6 +89,39 @@ class ChuniCryptoConfig:
self.__config, "chuni", "crypto", "encrypted_only", default=False
)
class ChuniMatchingConfig:
def __init__(self, parent_config: "ChuniConfig") -> None:
self.__config = parent_config
@property
def enable(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "chuni", "matching", "enable", default=False
)
@property
def stun_uri(self) -> str:
return CoreConfig.get_config_field(
self.__config, "chuni", "matching", "stun_uri", default="stun:stunserver.stunprotocol.org:3478"
)
@property
def turn_uri(self) -> str:
return CoreConfig.get_config_field(
self.__config, "chuni", "matching", "turn_uri", default="turn:stunserver.stunprotocol.org:3478"
)
@property
def match_time_limit(self) -> int:
return CoreConfig.get_config_field(
self.__config, "chuni", "matching", "match_time_limit", default=60
)
@property
def match_error_limit(self) -> int:
return CoreConfig.get_config_field(
self.__config, "chuni", "matching", "match_error_limit", default=9999
)
class ChuniConfig(dict):
def __init__(self) -> None:
@ -97,3 +130,4 @@ class ChuniConfig(dict):
self.mods = ChuniModsConfig(self)
self.version = ChuniVersionConfig(self)
self.crypto = ChuniCryptoConfig(self)
self.matching = ChuniMatchingConfig(self)