- fetcher: parse mihomo/clash.meta YAML subscriptions (proxies: list), auto-detect format (mihomo YAML vs plain vless:// lines) - config_builder: forward VLESS flow (xtls-rprx-vision) and per-node uTLS fingerprint to sing-box (required for Reality+Vision nodes) - default DNS upstream: udp://10.35.99.172 (public UDP resolvers unreachable on this network; old-sub nodes are hostnames) - Dockerfile: install PyYAML Verified: 50-node reality+vision subscription works end-to-end (sing-box check + live SOCKS tunnel); legacy vless:// subs unaffected.
35 lines
720 B
Python
35 lines
720 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 = ""
|
|
fingerprint: str = "chrome"
|
|
|
|
|
|
@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
|