Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Fixed missing documentation on socket addresses and client attributes #374

Merged
merged 1 commit into from
Nov 4, 2024
Merged
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
7 changes: 7 additions & 0 deletions docs/source/api/servers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ Client API
:special-members: __eq__, __hash__


Client Attributes
-----------------

.. autoclass:: INETClientAttribute
:members:


------

Server implementation tools
Expand Down
6 changes: 6 additions & 0 deletions src/easynetwork/lowlevel/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"IPv4SocketAddress",
"IPv6SocketAddress",
"ISocket",
"SocketAddress",
"SocketAttribute",
"SocketProxy",
"SupportsSocketOptions",
Expand Down Expand Up @@ -130,6 +131,8 @@ class TLSAttribute(typed_attr.TypedAttributeSet):


class IPv4SocketAddress(NamedTuple):
"""An internet (IPv4) socket address."""

host: str
port: int

Expand All @@ -145,6 +148,8 @@ def for_connection(self) -> tuple[str, int]:


class IPv6SocketAddress(NamedTuple):
"""An internet (IPv6) socket address."""

host: str
port: int
flowinfo: int = 0
Expand All @@ -162,6 +167,7 @@ def for_connection(self) -> tuple[str, int]:


SocketAddress: TypeAlias = IPv4SocketAddress | IPv6SocketAddress
"""An internet socket address, either IPv4 or IPv6."""


@overload
Expand Down
4 changes: 4 additions & 0 deletions src/easynetwork/servers/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@


class INETClientAttribute(typed_attr.TypedAttributeSet):
"""
Typed attributes which can be used on an :class:`AsyncBaseClientInterface`.
"""

__slots__ = ()

socket: socket_tools.ISocket = socket_tools.SocketAttribute.socket
Expand Down