refactor: split monolith into typed modules with retry logic
- 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()
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user