29 lines
709 B
Python
29 lines
709 B
Python
from core.models.BaseConnection import BaseConnection
|
|
from dataclasses import dataclass
|
|
|
|
# legacy:
|
|
@dataclass
|
|
class SystemConnection (BaseConnection):
|
|
|
|
def __post_init__(self):
|
|
|
|
if self.code not in ('vless', 'hysteria2', 'wireguard'):
|
|
raise ValueError('Invalid connection code.')
|
|
|
|
@staticmethod
|
|
def needs_proxy_configuration():
|
|
return False
|
|
|
|
# Potential refactor:
|
|
# from enum import Enum
|
|
# from typing import Literal
|
|
|
|
# class SystemConnectionTypes(str, Enum):
|
|
# WIREGUARD = "wireguard"
|
|
# HYSTERIA2 = "hysteria2"
|
|
# VLESS = "vless"
|
|
|
|
# @dataclass
|
|
# class SystemConnection(BaseConnection):
|
|
# code: SystemConnectionTypes
|
|
# masked: Literal[False] = False
|