20 lines
634 B
Python
20 lines
634 B
Python
from pathlib import Path
|
|
from typing import List, Tuple
|
|
|
|
def load_domains(path: Path) -> List[Tuple[str, int]]:
|
|
"""
|
|
Возвращает список кортежей (host, port).
|
|
Если порт не указан — 443.
|
|
"""
|
|
result: List[Tuple[str, int]] = []
|
|
for line in path.read_text(encoding='utf-8').splitlines():
|
|
line = line.strip()
|
|
if not line or line.startswith('#'):
|
|
continue
|
|
if ':' in line:
|
|
host, port = line.split(':', 1)
|
|
result.append((host.strip(), int(port)))
|
|
else:
|
|
result.append((line, 443))
|
|
return result
|