feat: implement get_remote_address via delegation pattern

This commit is contained in:
acul71
2025-03-13 14:08:13 +01:00
committed by Paul Robinson
parent 798229cd3a
commit fabf2cefc4
8 changed files with 72 additions and 1 deletions

View File

@ -78,6 +78,10 @@ class NetStream(INetStream):
async def reset(self) -> None:
await self.muxed_stream.reset()
def get_remote_address(self) -> Optional[tuple[str, int]]:
"""Delegate to the underlying muxed stream."""
return self.muxed_stream.get_remote_address()
# TODO: `remove`: Called by close and write when the stream is in specific states.
# It notifies `ClosedStream` after `SwarmConn.remove_stream` is called.
# Reference: https://github.com/libp2p/go-libp2p-swarm/blob/99831444e78c8f23c9335c17d8f7c700ba25ca14/swarm_stream.go # noqa: E501