mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 08:00:54 +00:00
fix: update QUIC examples to use loopback address for improved security
This commit is contained in:
@ -21,7 +21,7 @@ async def main():
|
|||||||
|
|
||||||
# Configure the listening address
|
# Configure the listening address
|
||||||
port = 8000
|
port = 8000
|
||||||
listen_addr = multiaddr.Multiaddr(f"/ip4/0.0.0.0/udp/{port}/quic-v1")
|
listen_addr = multiaddr.Multiaddr(f"/ip4/127.0.0.1/udp/{port}/quic-v1")
|
||||||
|
|
||||||
# Start the host
|
# Start the host
|
||||||
async with host.run(listen_addrs=[listen_addr]):
|
async with host.run(listen_addrs=[listen_addr]):
|
||||||
|
|||||||
@ -48,8 +48,8 @@ async def run_server(port: int, seed: int | None = None) -> None:
|
|||||||
if port <= 0:
|
if port <= 0:
|
||||||
port = find_free_port()
|
port = find_free_port()
|
||||||
|
|
||||||
# For QUIC, we need to use UDP addresses
|
# For QUIC, we need to use UDP addresses - use loopback for security
|
||||||
listen_addr = Multiaddr(f"/ip4/0.0.0.0/udp/{port}/quic")
|
listen_addr = Multiaddr(f"/ip4/127.0.0.1/udp/{port}/quic")
|
||||||
|
|
||||||
if seed:
|
if seed:
|
||||||
import random
|
import random
|
||||||
|
|||||||
Reference in New Issue
Block a user