|
resolve.h: shared helper that turns a dotted-quad or a hostname into an IPv4
address (DNS A query over a UDP socket to 1.1.1.1). nslookup now uses it and
slims down; wget uses it so you can name a host directly.
wget HOST|IP now: resolve -> TCP connect -> "GET / HTTP/1.0" with the real
Host header -> stream the body to the LCD/console until EOF. One command does
DNS + TCP + HTTP, all on the kernel socket layer.
Verified over tunbridge's NAT against the real internet:
/# wget example.com
connecting 172.66.147.243
HTTP/1.1 200 OK
Server: cloudflare
<!doctype html><html lang="en"><head><title>Example Domain</title>...
</body></html>
[eof]
The full HTML page arrives across many TCP segments and is reassembled and
printed - real DNS, real TCP, real HTTP, fetched by a Game Boy by name.
(tunbridge.py already sets up + tears down the NAT, so the demo is a one-liner:
sudo python3 tools/tunbridge.py "wget example.com")
|