Skip to content

Commit d83b73e

Browse files
committed
Add shared QUIC secret to h3 ASGI3 lab
1 parent 6b41967 commit d83b73e

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

examples/h3_asgi3_lab/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ The runtime container generates a short-lived localhost certificate in a shared
1414
Compose volume. The UI-side probe trusts that certificate when it opens the H3
1515
QUIC connection from the container network.
1616

17+
The Compose stack bind-mounts `examples/` into the containers so edits to the
18+
ASGI3 app and UI are picked up by container recreation without a full image
19+
rebuild.
20+
1721
## Run
1822

1923
```powershell

examples/h3_asgi3_lab/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ services:
1313
--transport udp --host 0.0.0.0 --port 8445
1414
--protocol http3 --http 3
1515
--ssl-certfile /certs/server-cert.pem --ssl-keyfile /certs/server-key.pem
16+
--quic-secret h3-asgi3-lab-shared-secret
1617
--alt-svc 'h3=":8445"; ma=60'
1718
ports:
1819
- "8445:8445/udp"
1920
volumes:
21+
- ../../examples:/app/examples:ro
2022
- h3-asgi3-certs:/certs
2123

2224
tigrcorn-h3-uix:
@@ -32,9 +34,11 @@ services:
3234
TIGRCORN_H3_TARGET_HOST: tigrcorn-h3-asgi3
3335
TIGRCORN_H3_TARGET_PORT: "8445"
3436
TIGRCORN_H3_SERVER_NAME: localhost
37+
TIGRCORN_H3_QUIC_SECRET: h3-asgi3-lab-shared-secret
3538
ports:
3639
- "8091:8090/tcp"
3740
volumes:
41+
- ../../examples:/app/examples:ro
3842
- h3-asgi3-certs:/certs
3943
depends_on:
4044
- tigrcorn-h3-asgi3

examples/h3_asgi3_lab/uix_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from pathlib import Path
99
from urllib.parse import parse_qs, urlsplit
1010

11-
from tigrcorn.constants import DEFAULT_QUIC_SECRET
1211
from tigrcorn.protocols.http3 import HTTP3ConnectionCore
1312
from tigrcorn.transports.quic import QuicConnection
1413
from tigrcorn.transports.quic.handshake import QuicTlsHandshakeDriver
@@ -23,9 +22,10 @@ async def _issue_h3_get(path: str) -> dict[str, object]:
2322
target_host = os.environ.get("TIGRCORN_H3_TARGET_HOST", "tigrcorn-h3-asgi3")
2423
target_port = int(os.environ.get("TIGRCORN_H3_TARGET_PORT", "8445"))
2524
server_name = os.environ.get("TIGRCORN_H3_SERVER_NAME", "localhost")
25+
quic_secret = os.environ.get("TIGRCORN_H3_QUIC_SECRET", "h3-asgi3-lab-shared-secret").encode("utf-8")
2626
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
2727
sock.setblocking(False)
28-
client = QuicConnection(is_client=True, secret=DEFAULT_QUIC_SECRET, local_cid=b"h3uixprobe0001")
28+
client = QuicConnection(is_client=True, secret=quic_secret, local_cid=b"h3uix001")
2929
client.configure_handshake(
3030
QuicTlsHandshakeDriver(
3131
is_client=True,

tests/test_h3_asgi3_lab.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def test_compose_runs_tigrcorn_h3_asgi3_and_uix_containers(self) -> None:
2020
self.assertIn("--transport udp", compose)
2121
self.assertIn("--protocol http3", compose)
2222
self.assertIn("--http 3", compose)
23+
self.assertIn("--quic-secret h3-asgi3-lab-shared-secret", compose)
24+
self.assertIn("TIGRCORN_H3_QUIC_SECRET", compose)
2325
self.assertNotIn("webtransport", compose.lower())
2426
self.assertIn('"8445:8445/udp"', compose)
2527
self.assertIn("tigrcorn-h3-uix:", compose)

0 commit comments

Comments
 (0)