Find a file
russell@unturf.com 271d712237
phase 6: TLS dist via inet_tls_dist
make_dist_tls_context() builds an ssl.SSLContext tuned for OTP defaults
(verify_peer, mTLS, TLSv1.2 minimum). Node accepts tls_context= and
wraps the TCP socket in TLS before the v6 handshake runs.

Critical quirk found by experimentation: inet_tls_dist uses {packet, 4}
on the SSL socket during the handshake. Plain inet_tcp_dist uses
{packet, 2} for handshake then switches to {packet, 4} post-nodeup.
handshake() now takes a frame_size= kwarg (2 or 4); Node auto-selects 4
whenever tls_context is supplied.

Cert requirements (found by experimentation against Erlang E2E):
  - CA cert with basicConstraints CA:TRUE
  - Leaf certs with SAN including the dist hostname (and localhost)
  - extendedKeyUsage covering both serverAuth and clientAuth

Tests:
  - make_dist_tls_context unit tests
  - Live: spawn erl -proto_dist inet_tls with SAN-bearing certs,
    Node.call(gen_target, {ping, 99}) round-trips through the tunnel
  - Live negative: plaintext connection to TLS-only peer must fail
  - Live negative: client cert from a different CA must fail

115 tests green across 5 consecutive runs, lint clean.
2026-06-16 12:06:07 -04:00
docs phase 6: TLS dist via inet_tls_dist 2026-06-16 12:06:07 -04:00
erldistpy phase 6: TLS dist via inet_tls_dist 2026-06-16 12:06:07 -04:00
tests phase 6: TLS dist via inet_tls_dist 2026-06-16 12:06:07 -04:00
.gitignore phase 6: TLS dist via inet_tls_dist 2026-06-16 12:06:07 -04:00
LICENSE phase 0 + 1: repo bones and ETF codec 2026-06-16 10:39:01 -04:00
Makefile phase 0 + 1: repo bones and ETF codec 2026-06-16 10:39:01 -04:00
pyproject.toml phase 0 + 1: repo bones and ETF codec 2026-06-16 10:39:01 -04:00
README.md phase 0 + 1: repo bones and ETF codec 2026-06-16 10:39:01 -04:00

erldistpy

Native Python client for our Erlang distribution protocol. Talk Erlang/Elixir nodes from CPython without HTTP shim layers.

Built to swap into unfeed's WalletTransport so a Python web app can call Unsandbox.WalletRPC over native dist instead of HTTPS. Same gen_call semantics, lower latency, fewer moving parts.

Status

Phase 0 — repo bones. See docs/ROADMAP.md for the phase plan.

Quick start

make bootstrap   # create venv, install editable + dev deps
make test        # run pytest
make lint        # ruff check

Scope

  • ETF (External Term Format) codec — encode/decode Erlang terms
  • EPMD client — node name → port lookup
  • Distribution handshake — cookie auth, version negotiation
  • gen_call to registered processes on a remote node
  • TLS dist support (Erlang inet_tls_dist)

Out of scope: full Erlang node impersonation, link/monitor lifecycles, distributed Mnesia. We are a client, not a peer node.

Why not Pyrlang?

Pyrlang implements a full asyncio Erlang node. Heavy, asyncio-first, complex. We need a small synchronous client that fits behind the same WalletTransport Protocol as httpx. Different shape.

License

Unlicense (public domain).