22 lines
No EOL
630 B
Python
22 lines
No EOL
630 B
Python
from core.models.BaseConnection import BaseConnection
|
|
from dataclasses import dataclass, field
|
|
from typing import Optional
|
|
|
|
@dataclass
|
|
class SystemConnection(BaseConnection):
|
|
operator_id: Optional[int] = field(default=None)
|
|
protocol: Optional[str] = field(default=None)
|
|
|
|
def __post_init__(self):
|
|
if self.code not in ('wireguard', 'operator'):
|
|
raise ValueError('Invalid connection code.')
|
|
|
|
@staticmethod
|
|
def needs_proxy_configuration():
|
|
return False
|
|
|
|
def needs_operator_proxy(self):
|
|
return self.code == 'operator'
|
|
|
|
def get_protocol(self):
|
|
return self.protocol |