ed52257dbe
- models.py: ProxyInfo and DNSServerConfig dataclasses with type hints - fetcher.py: subscription fetcher with exponential backoff retries (3 attempts) plus VLESS URL parser - config_builder.py: sing-box config builder decomposed into focused helpers - main.py: orchestrator with setup_logging(), print_banner(), pick_node()
34 lines
688 B
Python
34 lines
688 B
Python
#!/usr/bin/env python3
|
|
"""Data models for Sub2SOCKS."""
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
|
|
@dataclass
|
|
class ProxyInfo:
|
|
"""Parsed VLESS proxy configuration."""
|
|
uuid: str
|
|
server: str
|
|
port: int
|
|
security: str = "tls"
|
|
type: str = "tcp"
|
|
sni: str = ""
|
|
alpn: str = ""
|
|
pbk: str = ""
|
|
sid: str = ""
|
|
spx: str = ""
|
|
path: str = "/"
|
|
serviceName: str = ""
|
|
host: str = ""
|
|
flow: str = ""
|
|
|
|
|
|
@dataclass
|
|
class DNSServerConfig:
|
|
"""Sing-box DNS server configuration."""
|
|
server_type: str # udp, tls, https
|
|
server: str
|
|
server_port: int = 53
|
|
tls_config: Optional[Dict[str, Any]] = None
|