Agree with the comment above, multiplexing is necessary to forward multiple TCP connections over a single socket stream. Additionally we can try using existing protocols like SSH-style multiplexing SOCKS5 or QUIC-based tunneling to avoid reinventing the wheel.. a TUN/TAP interface could be an option as well.