Skip to content

Conversation

@mfahampshire
Copy link
Contributor

@mfahampshire mfahampshire commented Jan 12, 2026

Part 3 of breaking #6129 into smaller chunks.

This is the third and most rough / proof of concept work. If it is to be merged instead of left as a historical draft, should only be looked at after #6320 is merged and this branch is rebased removing most of the commits).

This contains the mixtcp proof of concept


This change is Reviewable

Introduces a TCP-socket-like abstraction for mixnet communication:
- MixSocket: unconnected socket that can be connected or used as listener
- MixStream: bidirectional stream with send/recv methods
- MixStreamReader/MixStreamWriter: split halves for concurrent I/O
- NetworkEnvironment: helper for loading environment configs

Uses SURBs for anonymous replies when operating in listener mode.
Adds methods to query exit-capable gateways from the nym-api:
- get_all_basic_exit_assigned_nodes_with_metadata: paginated fetch
- get_basic_exit_assigned_nodes_v2: single page query

Used by IpMixStream for automatic gateway selection.
IpMixStream wraps MixStream to tunnel IP packets through Exit Gateway
IPRs (IP Packet Routers), enabling use of the mixnet as a proxy for
regular internet traffic.

The ip_packet_client module contains IPR connection and protocol logic
forked from nym-ip-packet-client and adapted for SDK use:
- IprClientConnect: handles IPR connection establishment
- IprListener: processes incoming IP packet responses
- Helper functions for IP packet construction/parsing (ICMP, etc.)
- Error types for IPR operations
Updates lib.rs doc comments and README.md to describe new modules:
- stream_wrapper: socket-like abstraction (MixStream, IpMixStream)
- Marks tcp_proxy as deprecated in favor of stream_wrapper
Introduces mixtcp, a smoltcp-based device that tunnels TCP/IP through
the mixnet via IpMixStream and Exit Gateway IPRs.

Components:
- NymIprDevice: smoltcp::phy::Device impl using channel-based I/O
- NymIprBridge: async task bridging the device to IpMixStream
- create_device(): helper to set up the complete stack

Examples:
- cloudflare_ping: ICMP ping through the mixnet
- https_client: HTTPS requests through the mixnet
- tls: TLS connections through the mixnet
@vercel
Copy link

vercel bot commented Jan 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nym-explorer-v2 Ready Ready Preview, Comment Jan 12, 2026 6:58pm

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.

2 participants