You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where transport is an instance of asyncio.BaseTransport.
Looking at BaseTransport docs, get_extra_info("peername") calls socket.getpeername() and returns the result.
For IPv4 sockets at least, socket.getpeername() seems to return an ip-address,port tuple. So I think a more accurate annotation for Session.peer would be something like tuple[str, int] | None.
The text was updated successfully, but these errors were encountered:
cuu508
added a commit
to cuu508/aiosmtpd
that referenced
this issue
Oct 28, 2024
aiosmtpd can listen on IPv4 address, on IPv6 address (by using aiosmtpd.controller.Controller), and to an UNIX socket (by using aiosmtpd.controller.UnixSocketController). The type of Session.peer is different in each case:
The type annotation for Session.peer is currently:
This attribute appears to be set in
connection_made()
like so:Where transport is an instance of
asyncio.BaseTransport
.Looking at BaseTransport docs,
get_extra_info("peername")
callssocket.getpeername()
and returns the result.For IPv4 sockets at least,
socket.getpeername()
seems to return anip-address,port
tuple. So I think a more accurate annotation for Session.peer would be something liketuple[str, int] | None
.The text was updated successfully, but these errors were encountered: