Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aiohttp_remotes/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from aiohttp import web


class ABC(abc.ABC):
class AbstractRemote(abc.ABC):
@abc.abstractmethod
async def setup(self, app: web.Application) -> None:
pass # pragma: no cover
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_remotes/allowed_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from aiohttp import web

from .abc import ABC
from .abc import AbstractRemote


class ANY:
def __contains__(self, item: object) -> bool:
return True


class AllowedHosts(ABC):
class AllowedHosts(AbstractRemote):
def __init__(
self,
allowed_hosts: Iterable[str] = ("*",),
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_remotes/basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

from aiohttp import hdrs, web

from .abc import ABC
from .abc import AbstractRemote


class BasicAuth(ABC):
class BasicAuth(AbstractRemote):
def __init__(
self,
username: str,
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_remotes/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import aiohttp
from aiohttp import web

from .abc import ABC
from .abc import AbstractRemote
from .exceptions import IPNetwork
from .log import logger


class Cloudflare(ABC):
class Cloudflare(AbstractRemote):
def __init__(self, client: Optional[aiohttp.ClientSession] = None) -> None:
self._ip_networks: Set[IPNetwork] = set()
self._client = client
Expand Down
6 changes: 3 additions & 3 deletions aiohttp_remotes/forwarded.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

from aiohttp import web

from .abc import ABC
from .abc import AbstractRemote
from .exceptions import IncorrectForwardedCount, RemoteError
from .utils import TrustedOrig, parse_trusted_list, remote_ip


class ForwardedRelaxed(ABC):
class ForwardedRelaxed(AbstractRemote):
def __init__(self, num: int = 1) -> None:
self._num = num

Expand Down Expand Up @@ -38,7 +38,7 @@ async def middleware(
return await handler(request)


class ForwardedStrict(ABC):
class ForwardedStrict(AbstractRemote):
def __init__(self, trusted: TrustedOrig, *, white_paths: Iterable[str] = ()):
self._trusted = parse_trusted_list(trusted)
self._white_paths = set(white_paths)
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_remotes/secure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

from aiohttp import web

from .abc import ABC
from .abc import AbstractRemote
from .log import logger


@web.middleware
class Secure(ABC):
class Secure(AbstractRemote):
def __init__(
self,
*,
Expand Down
4 changes: 2 additions & 2 deletions aiohttp_remotes/x_forwarded.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from aiohttp import hdrs, web

from .abc import ABC
from .abc import AbstractRemote
from .exceptions import (
IncorrectHostCount,
IncorrectProtoCount,
Expand All @@ -26,7 +26,7 @@
)


class XForwardedBase(ABC):
class XForwardedBase(AbstractRemote):
async def setup(self, app: web.Application) -> None:
app.middlewares.append(self.middleware)

Expand Down
Loading