82 lines
1.9 KiB
Python
82 lines
1.9 KiB
Python
from __future__ import annotations
|
|
|
|
import re
|
|
from typing import Any
|
|
from typing import Literal
|
|
|
|
from PySide6.QtCore import Qt
|
|
|
|
_NEXT_CHECK_RE = re.compile(r"(?i)next check in \d+s")
|
|
LoginPage = Literal["main", "login"]
|
|
LOCATION_TARGET_ROLE = Qt.UserRole + 1
|
|
SINGBOX_STATUS_ROLE = Qt.UserRole + 2
|
|
SINGBOX_EDITOR_PROTOCOL_OPTIONS = [
|
|
("VLESS", "vless"),
|
|
("Trojan", "trojan"),
|
|
("Shadowsocks", "shadowsocks"),
|
|
("Hysteria2", "hysteria2"),
|
|
("TUIC", "tuic"),
|
|
("WireGuard", "wireguard"),
|
|
]
|
|
SINGBOX_EDITOR_PROTOCOL_IDS = tuple([pid for _label, pid in SINGBOX_EDITOR_PROTOCOL_OPTIONS])
|
|
SINGBOX_PROTOCOL_SEED_SPEC: dict[str, dict[str, Any]] = {
|
|
"vless": {
|
|
"port": 443,
|
|
"security": "none",
|
|
"proxy_defaults": {
|
|
"uuid": "",
|
|
},
|
|
},
|
|
"trojan": {
|
|
"port": 443,
|
|
"security": "tls",
|
|
"proxy_defaults": {
|
|
"password": "",
|
|
},
|
|
},
|
|
"shadowsocks": {
|
|
"port": 443,
|
|
"security": "none",
|
|
"proxy_defaults": {
|
|
"method": "aes-128-gcm",
|
|
"password": "",
|
|
},
|
|
},
|
|
"hysteria2": {
|
|
"port": 443,
|
|
"security": "tls",
|
|
"proxy_defaults": {
|
|
"password": "",
|
|
},
|
|
"tls_security": "tls",
|
|
},
|
|
"tuic": {
|
|
"port": 443,
|
|
"security": "tls",
|
|
"proxy_defaults": {
|
|
"uuid": "",
|
|
"password": "",
|
|
},
|
|
"tls_security": "tls",
|
|
},
|
|
"wireguard": {
|
|
"port": 51820,
|
|
"security": "none",
|
|
"proxy_defaults": {
|
|
"private_key": "",
|
|
"peer_public_key": "",
|
|
"local_address": [],
|
|
},
|
|
},
|
|
}
|
|
|
|
__all__ = [
|
|
"LOCATION_TARGET_ROLE",
|
|
"LoginPage",
|
|
"SINGBOX_EDITOR_PROTOCOL_IDS",
|
|
"SINGBOX_EDITOR_PROTOCOL_OPTIONS",
|
|
"SINGBOX_PROTOCOL_SEED_SPEC",
|
|
"SINGBOX_STATUS_ROLE",
|
|
"_NEXT_CHECK_RE",
|
|
]
|