test(e2e): add hosts module e2e test suite

Verify the static hosts mapping (HostMapper) overrides DNS: a mapped
hostname resolves to the configured IP and reaches the echo server,
while an unmapped hostname fails to resolve.
This commit is contained in:
ginuerzh
2026-07-16 20:53:30 +08:00
parent 6746f556b7
commit 9355607ba7
2 changed files with 103 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# HTTP proxy with a static hosts mapping. The made-up hostname echo.internal is
# mapped to the echo server's real IP, overriding DNS. A request to
# echo.internal resolves via the mapping and reaches the echo server; a request
# to an unmapped hostname fails to resolve and never connects.
services:
- name: proxy
addr: ":8080"
hosts: hosts-0
handler:
type: http
listener:
type: tcp
hosts:
- name: hosts-0
mappings:
- ip: {{.ServerAddr}}
hostname: echo.internal