Add Debian deployment, MariaDB storage and randomized proxy routing
This commit is contained in:
@@ -137,6 +137,10 @@ def _pool_entry(arguments, project, service):
|
||||
class PoolService:
|
||||
def __init__(self, settings):
|
||||
self.settings = settings
|
||||
self.linux = None
|
||||
if os.name != "nt":
|
||||
from studio.linux_pool import LinuxPoolService
|
||||
self.linux = LinuxPoolService(settings)
|
||||
self.session = requests.Session()
|
||||
self.session.trust_env = False
|
||||
self.lock = threading.Lock()
|
||||
@@ -154,6 +158,8 @@ class PoolService:
|
||||
return json.loads(result.stdout.decode("utf-8-sig"))
|
||||
|
||||
def status(self, config=None):
|
||||
if self.linux:
|
||||
return self.linux.status(config)
|
||||
if config is None:
|
||||
config = self.settings.read()
|
||||
project = Path(config["pool_project"])
|
||||
@@ -233,6 +239,8 @@ class PoolService:
|
||||
return "\n".join(lines)
|
||||
|
||||
def manage(self, action):
|
||||
if self.linux:
|
||||
return self.linux.manage(action)
|
||||
if action not in ("start", "stop", "status"):
|
||||
raise ValueError("代理池操作无效")
|
||||
with self.lock:
|
||||
|
||||
Reference in New Issue
Block a user