Skip to content

[IMP] Switch from socat to iptables-based transparent TCP proxy#29

Draft
josep-tecnativa wants to merge 2 commits intomasterfrom
switch-from-socat-to-iptables
Draft

[IMP] Switch from socat to iptables-based transparent TCP proxy#29
josep-tecnativa wants to merge 2 commits intomasterfrom
switch-from-socat-to-iptables

Conversation

@josep-tecnativa
Copy link
Contributor

This PR replaces the per-port socat model with a single asyncio-based
transparent TCP proxy using iptables NAT REDIRECT and SO_ORIGINAL_DST.

The previous implementation spawned one socat process per port, which
introduced scalability and reliability issues (thread/process explosion,
resource consumption, restart complexity, DNS update handling, etc.).

The new design:

  • Uses a single TCP listener
  • Redirects traffic via iptables
  • Automatically handles any TCP port (default behaviour)
  • Improves PRE_RESOLVE DNS refresh logic

By default, all TCP ports are now allowed unless PORT is explicitly set.

Requires CAP_NET_ADMIN.

@josep-tecnativa josep-tecnativa marked this pull request as draft February 13, 2026 15:57
@josep-tecnativa josep-tecnativa force-pushed the switch-from-socat-to-iptables branch from 41c4ec5 to 092aa71 Compare February 16, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments