chore: Update network address config to use loopback (127.0.0.1) instead of wildcard (0.0.0.0) across multiple examples and utilities.

This commit is contained in:
yashksaini-coder
2025-09-02 03:00:18 +05:30
parent 5c11ac20e7
commit 87550113a4
18 changed files with 25 additions and 26 deletions

View File

@ -58,7 +58,7 @@ def print_identify_response(identify_response: Identify):
async def run(port: int, destination: str, use_varint_format: bool = True) -> None:
localhost_ip = "0.0.0.0"
localhost_ip = "127.0.0.1"
if not destination:
# Create first host (listener)
@ -79,10 +79,9 @@ async def run(port: int, destination: str, use_varint_format: bool = True) -> No
# Start the peer-store cleanup task
nursery.start_soon(host_a.get_peerstore().start_cleanup_task, 60)
# Get the actual address and replace 0.0.0.0 with 127.0.0.1 for client
# connections
# Get the actual address
server_addr = str(host_a.get_addrs()[0])
client_addr = server_addr.replace("/ip4/0.0.0.0/", "/ip4/127.0.0.1/")
client_addr = server_addr
format_name = "length-prefixed" if use_varint_format else "raw protobuf"
format_flag = "--raw-format" if not use_varint_format else ""