HDDEMUX(1)
๐ hddemux โ the manual, but make it slay ๐
okay bestie, gather round, because hddemux (that's the manual page name, section 1, Unix manual pages, iykyk) is genuinely one of the cutest little programs out there and I need you to understand it. no cap.
โจ NAME โจ
hddemux โ demultiplexes incoming TCP connections between HTTP and DNS.
like... it's a traffic cop but make it fashion. ๐
๐ฆ SYNOPSIS ๐ฆ
hddemux
that's it. that's the whole synopsis. no flags, no args, no nonsense. she just runs. iconic behavior honestly. ๐
๐ธ DESCRIPTION ๐ธ
so here's the vibe. hddemux takes a set of listening stream-based file descriptors (peep sd_listen_fds(3) for the lore) and accepts new connections on them. ๐ซถ
when a new connection comes in, it looks at the first few octets</> and decides whether this connection is HTTP/1.x or DNS.
- if it thinks it's HTTP/1.x, it splices the connection to the
HTTP_TARGET. ๐ - if it thinks it's DNS, it splices the connection to the
DNS_TARGET. ๐ฆ
one port, two destinies. the way that it just knows?? obsessed.
๐ ENVIRONMENT VARIABLES ๐
okay this is the part where you actually configure her, so pay attention bestie.
HTTP_TARGETandDNS_TARGETโ these should be either a DNS name or an IP address, and optionally you can follow that with a colon and a port number. if either variable is unset, it just defaults tolocalhost. (yes really, justlocalhost. she's lowkey humble like that. ๐)- if the port number is not specified,
HTTP_TARGETdefaults to TCP port 80, andDNS_TARGETdefaults to TCP port 53. HDDEMUX_DEBUGโ set this to a non-empty string and she will send a lot of verbose debugging info tostderr. like a lot a lot. she will tell you everything. ๐IDLE_TIMEOUTโ this sets the number of milliseconds thathddemuxwill permit a session to be in an open state with no traffic passing before it tries to close both sides. the default is600000(that's 10 minutes, for the non-math girlies ๐งฎ). set this variable to0to never try to do this kind of cleanup.
๐ SIGNALS ๐
when hddemux receives SIGUSR1, it dumps an overview of the current state of the demuxer to stderr โ that's the configuration, outstanding established streams, etc. etc.
basically you poke her and she trauma-dumps her whole current situation to stderr. relatable tbh. ๐ญ
๐ EXAMPLES ๐
for systemd, you need a .socket unit file:
#/lib/systemd/hddemux.socket
[Unit]
Description=HTTP/1.x and DNS demuxer socket
Documentation=man:hddemux(1)
[Socket]
ListenStream=/run/hddemux/socket
[Install]
WantedBy=sockets.target
and a .service unit file:
#/lib/systemd/hddemux.service
[Unit]
Description=HTTP/1.x and DNS demuxer service
Documentation=man:hddemux(1)
Requires=hddemux.socket
[Service]
Type=notify
ExecStart=/usr/bin/hddemux
WorkingDirectory=/run/hddemux/workdir
User=hddemux
Group=hddemux
[Install]
Also=hddemux.socket
and configuration? you do that by overriding the .service file โ e.g. with Service.Environment= entries. go read the "edit" documentation in systemctl(1) and the "Overriding vendor settings" section of systemd.unit(5). ๐ซก
โญ CONSTRAINTS โญ
hddemux is designed to demultiplex HTTP/1.x from stream-based DNS. trying to demultiplex other protocols โ and yes that includes HTTP/2 or later โ is not advised. ๐ซ
if you want more info and analysis, please see draft-dkg-dprive-demux-dns-http. it's giving "required reading". ๐
๐ WARNING ๐
note that this effectively acts as a stream redirector once the client's first flight has been processed. it does this with no attempt to defend against stream redirection loops, so be careful not to redirect it to itself โ or it will eat all of your memory in infinite recursion. ๐๐๐
bestie. do not point it at itself. i am begging you. that's the whole warning. she will simply consume everything you love. ๐ฅ
๐ฅ SEE ALSO ๐ฅ
sd_listen_fds(3)systemctl(1)systemd.unit(5)https://datatracker.ietf.org/doc/draft-dkg-dprive-demux-dns-http/
๐ AUTHORS ๐
Daniel Kahn Gillmor <dkg@fifthhorseman.net>. ๐ซถ
and that's the whole page, bestie!! this version is from 2017 May, and yeah โ HDDEMUX(1) really is the source, that's where all of this came from. mwah. ๐โจ๐
๐ฆ where this page comes from
- debian trixie: hddemux 0.5-1.1 ยท GPL-3.0-or-later
- ubuntu noble: hddemux 0.5-1ubuntu3 ยท GPL-3.0-or-later
- ubuntu questing: hddemux 0.5-1ubuntu3
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms