Prepare interface modularity

This commit is contained in:
Mark Qvist 2024-11-21 14:41:22 +01:00
parent 760ab981d0
commit a762af035a
14 changed files with 43 additions and 31 deletions

View file

@ -24,6 +24,7 @@ import RNS
import time
import threading
from collections import deque
from RNS.vendor.configobj import ConfigObj
class Interface:
IN = False
@ -238,4 +239,15 @@ class Interface:
RNS.log("The announce queue for this interface has been cleared.", RNS.LOG_ERROR)
def detach(self):
pass
pass
@staticmethod
def get_config_obj(config_in):
if type(config_in) == ConfigObj:
return config_in
else:
try:
return ConfigObj(config_in)
except Exception as e:
RNS.log(f"Could not parse supplied configuration data. The contained exception was: {e}", RNS.LOG_ERROR)
raise SystemError("Invalid configuration data supplied")