Files
WGDashboard/src/modules/WireguardConfigurationInfo.py

25 lines
732 B
Python
Raw Normal View History

2025-08-14 22:36:14 +08:00
from pydantic import BaseModel, PositiveInt
class OverridePeerSettingsClass(BaseModel):
DNS: str = ''
EndpointAllowedIPs: str = ''
MTU: str | int = ''
PersistentKeepalive: int | str = ''
PeerRemoteEndpoint: str = ''
ListenPort: int | str = ''
class PeerGroupsClass(BaseModel):
2025-08-15 11:45:06 +08:00
GroupName: str = ''
2025-08-14 22:36:14 +08:00
Description: str = ''
BackgroundColor: str = ''
Peers: list[str] = []
class WireguardConfigurationInfo(BaseModel):
Description: str = ''
OverridePeerSettings: OverridePeerSettingsClass = OverridePeerSettingsClass(**{})
PeerGroups: dict[str, PeerGroupsClass] = {}
if __name__ == '__main__':
2025-08-15 11:45:06 +08:00
d = WireguardConfigurationInfo.model_validate_json("")
2025-08-14 22:36:14 +08:00
print(d.model_dump())