-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make backends extensible (#2)
* refactor: add black for formatting and some half-way refactorings, not functional yet. * refactor: use hatch * fix: some fixes to get stuff working * fix: get some xray functionality working * fix: get user addition/removal/update working * fix: xray logs * fix: xray core restart * fix: user usages * feat: log user modifications
- Loading branch information
1 parent
4450445
commit c962d16
Showing
240 changed files
with
1,067 additions
and
750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,3 +169,5 @@ xray-core | |
*config.json | ||
bin/ | ||
pyvenv.cfg | ||
_version.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
"""Initiate logger for marznode""" | ||
|
||
import logging | ||
|
||
from marznode import config | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"""What a vpn server should do""" | ||
|
||
from abc import ABC, abstractmethod | ||
from collections.abc import AsyncIterator | ||
from typing import Any | ||
|
||
from marznode.models import User, Inbound | ||
|
||
|
||
class VPNBackend(ABC): | ||
@abstractmethod | ||
def contains_tag(self, tag: str) -> bool: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def start(self) -> None: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def restart(self, backend_config: Any) -> None: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def add_user(self, user: User, inbound: Inbound) -> None: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def remove_user(self, user: User, inbound: Inbound) -> None: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
def get_logs(self, include_buffer: bool) -> AsyncIterator: | ||
raise NotImplementedError | ||
|
||
@abstractmethod | ||
async def get_usages(self): | ||
raise NotImplementedError |
File renamed without changes.
Oops, something went wrong.