Skip to content

Commit 7d7cc29

Browse files
authored
Revert "feat: 初步支持自动打洞"
1 parent c74c79d commit 7d7cc29

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

core/cluster.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
import pyzstd as zstd
1313
import aiohttp
1414
from tqdm import tqdm
15-
import subprocess
16-
import re
15+
1716
from . import web
1817
from . import utils, logger, config, scheduler, units, storages, i18n
1918
from .storages import File as SFile
@@ -753,34 +752,6 @@ async def callback(data: tuple[Any, Any]):
753752
scheduler.cancel(timeout_task)
754753
return fut.result()
755754

756-
class Tunnel():
757-
def __init__(self,tunnel_program: str,output_regex: str,timeout: int=30):
758-
self.tunnel_program = tunnel_program
759-
self.output_regex = output_regex
760-
self.timeout = timeout
761-
self.output_logs = []
762-
async def create_tunnel(self):
763-
process = subprocess.Popen(
764-
[self.tunnel_program],
765-
stdout=subprocess.PIPE,
766-
stderr=subprocess.PIPE,
767-
text=True
768-
)
769-
for line in process.stdout:
770-
self.output_logs.append(line.strip())
771-
async def get_tunnel_info(self):
772-
regex = re.compile(self.output_regex)
773-
for log in self.output_logs:
774-
match = regex.search(log)
775-
if match:
776-
host = match.group('host')
777-
port = match.group('port')
778-
return {'host': host, 'port': port}
779-
raise ValueError("无法获取隧道信息")
780-
async def get_port(self):
781-
return (await self.get_tunnel_info()).get('port',1145)
782-
783-
784755
@dataclass
785756
class ClusterCertificate:
786757
host: str

0 commit comments

Comments
 (0)