<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmet Göktürk</title>
    <description>The latest articles on DEV Community by Ahmet Göktürk (@gokturka).</description>
    <link>https://dev.to/gokturka</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4119914%2Fbfc64564-a191-4c54-b7f9-f87c2f2099c0.jpg</url>
      <title>DEV Community: Ahmet Göktürk</title>
      <link>https://dev.to/gokturka</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gokturka"/>
    <language>en</language>
    <item>
      <title>Metrice: Zero-dependency post-quantum P2P mesh network</title>
      <dc:creator>Ahmet Göktürk</dc:creator>
      <pubDate>Thu, 10 Sep 2026 22:06:31 +0000</pubDate>
      <link>https://dev.to/gokturka/metrice-zero-dependency-post-quantum-p2p-mesh-network-33ae</link>
      <guid>https://dev.to/gokturka/metrice-zero-dependency-post-quantum-p2p-mesh-network-33ae</guid>
      <description>&lt;p&gt;Metrice is a decentralized peer-to-peer (P2P) mesh networking protocol engineered with zero external npm dependencies (Zero-Dependency), running natively on Node.js core libraries (&lt;code&gt;node:crypto&lt;/code&gt;, &lt;code&gt;node:net&lt;/code&gt;, &lt;code&gt;node:dgram&lt;/code&gt;, &lt;code&gt;node:sqlite&lt;/code&gt;, &lt;code&gt;node:dns&lt;/code&gt;). It features quantum-resistant cryptography (Post-Quantum Cryptography) and a Tor-like multi-hop onion routing architecture.&lt;/p&gt;

&lt;p&gt;The system incorporates NIST FIPS 203 ML-KEM-768 key encapsulation, Ed25519-based RFC 4648 Base32 cryptographic node identities, AutoNAT dialback consensus, Rendezvous persistent reverse tunnels for CGNAT traversal, multi-relay transit bridging (EDGE Transit Routing / &lt;code&gt;CAP_EDGE_TRANSIT&lt;/code&gt;), Layer 4 HAProxy PROXY Protocol v1 &amp;amp; v2 support, and an embedded in-memory SSH-2 server.&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture &amp;amp; Core Components
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Cryptographic Node Identity &amp;amp; Addressing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Every node maintains a persistent Ed25519 identity key pair.&lt;/li&gt;
&lt;li&gt;The 16-character Node ID (&lt;code&gt;NodeID&lt;/code&gt;) is derived from the first 10 bytes (80 bits) of the SHA-256 digest of the raw Ed25519 public key encoded in RFC 4648 Base32 (&lt;code&gt;^[a-z2-7]{16}$&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Network addressing is completely IP/Port agnostic using virtual &lt;code&gt;.mesh&lt;/code&gt; domain namespaces:

&lt;ul&gt;
&lt;li&gt;User Address: &lt;code&gt;@user:NodeID.mesh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Federated Channel: &lt;code&gt;#channel:NodeID.mesh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Global Mesh Channel: &lt;code&gt;#genel&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. AutoNAT &amp;amp; Reachability Consensus
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Nodes exchange their observed peer addresses (&lt;code&gt;observedAddress&lt;/code&gt;) during the cryptographic handshake.&lt;/li&gt;
&lt;li&gt;A Reflected Public IP consensus is established once at least two independent peers report consistent observations.&lt;/li&gt;
&lt;li&gt;Nodes initiate reachability testing by transmitting a &lt;code&gt;DIALBACK_REQUEST&lt;/code&gt; containing a cryptographic nonce.&lt;/li&gt;
&lt;li&gt;The target peer attempts a TCP dialback connection to the requesting node's physical remote address (&lt;code&gt;socket.realRemoteAddress || socket.remoteAddress&lt;/code&gt;). If verified, the node attains the &lt;code&gt;CAP_RELAY&lt;/code&gt; role; otherwise, it remains in &lt;code&gt;CAP_EDGE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSRF Defense:&lt;/strong&gt; Injected &lt;code&gt;targetIp&lt;/code&gt; values inside &lt;code&gt;DIALBACK_REQUEST&lt;/code&gt; are strictly discarded; only the verified physical TCP socket remote address is used. Dialbacks targeting RFC 1918 private networks or loopback addresses are blocked.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Rendezvous, CGNAT Reverse Tunnels &amp;amp; Transit Routing (CAP_EDGE_TRANSIT)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Firewalled or CGNAT-bound &lt;code&gt;EDGE&lt;/code&gt; nodes establish persistent reverse TCP tunnels to multiple publicly reachable &lt;code&gt;RELAY&lt;/code&gt; nodes (&lt;code&gt;maxEdgeRendezvousRelays&lt;/code&gt;, default: 4).&lt;/li&gt;
&lt;li&gt;Tunnel sessions are authenticated via Ed25519 cryptographic signatures in &lt;code&gt;RENDEZVOUS_BIND&lt;/code&gt; packets.&lt;/li&gt;
&lt;li&gt;Firewall session state is preserved through 30-second single-byte keepalives: &lt;code&gt;0x09&lt;/code&gt; (PING) and &lt;code&gt;0x0A&lt;/code&gt; (PONG).&lt;/li&gt;
&lt;li&gt;Active tunnel capacity per relay is bounded to 64 to prevent resource exhaustion (&lt;code&gt;maxRendezvousTunnels&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Role Escalation (&lt;code&gt;CAP_EDGE_TRANSIT&lt;/code&gt;):&lt;/strong&gt; An EDGE node connected to at least two independent relays with &lt;code&gt;ALLOW_EDGE_ROUTING=true&lt;/code&gt; dynamically ascends to &lt;code&gt;CAP_EDGE_TRANSIT&lt;/code&gt;, enabling bidirectional in-and-out reverse tunnel bridging between segmented relays.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loop-Free Gossip Bridging:&lt;/strong&gt; Transit edge nodes cross-bridge presence announcements (&lt;code&gt;PRESENCE_ANNOUNCE&lt;/code&gt;) and global &lt;code&gt;#genel&lt;/code&gt; messages between relays without broadcast loops (&lt;code&gt;ALLOW_EDGE_GOSSIP=true&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. 3-Hop Telescopic Post-Quantum Onion Routing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Anonymous 3-hop circuits (Inbound Guard, Relay/Transit, Outbound Exit) conceal network topology and packet trajectories.&lt;/li&gt;
&lt;li&gt;The circuit selection pool (&lt;code&gt;relayPool&lt;/code&gt;) integrates both backbone &lt;code&gt;RELAY&lt;/code&gt; nodes and &lt;code&gt;CAP_EDGE_TRANSIT&lt;/code&gt; nodes to enhance routing diversity.&lt;/li&gt;
&lt;li&gt;Each hop negotiates ephemeral symmetric keys via NIST FIPS 203 ML-KEM-768 (Kyber-768) key encapsulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traffic Analysis &amp;amp; DPI Resistance:&lt;/strong&gt; All onion cells (&lt;code&gt;ONION_CELL&lt;/code&gt;) are padded to a strict uniform length of 2048 bytes (Uniform Cell Padding). Raw payloads are capped at 768 bytes (&lt;code&gt;MAX_ONION_PAYLOAD&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Cells are never exposed in plaintext; transport is secured inside AES-256-GCM &lt;code&gt;ENCRYPTED_FRAME&lt;/code&gt; blocks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Distributed Presence &amp;amp; SQLite Routing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Presence and channel subscriptions are propagated across the mesh using Ed25519-signed &lt;code&gt;PRESENCE_ANNOUNCE&lt;/code&gt; gossip packets.&lt;/li&gt;
&lt;li&gt;Raw IP addresses are scrubbed from gossip frames; announcements reference only virtual domain names or &lt;code&gt;.mesh&lt;/code&gt; identifiers.&lt;/li&gt;
&lt;li&gt;Ephemeral routing entries are cached in memory and committed to the SQLite &lt;code&gt;routing_table&lt;/code&gt;. Inactive records expire automatically after 60 seconds (TTL).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. In-Memory SSH-2 Server &amp;amp; Two-Factor Vault Authentication
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Pure JavaScript SSH-2 server operates natively without requiring external system daemons (&lt;code&gt;sshd&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Version Synchronisation:&lt;/strong&gt; Server identification string (&lt;code&gt;sshServerVersion&lt;/code&gt;) dynamically aligns with &lt;code&gt;package.json&lt;/code&gt; through &lt;code&gt;src/version.js&lt;/code&gt; (default: &lt;code&gt;SSH-2.0-Metrice_2.6.0&lt;/code&gt;) and remains configurable via environment variables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two-Factor Ephemeral Vault Derivation:&lt;/strong&gt; User passwords are salted with the client's Ed25519 public key and derived via Scrypt (N=16384, r=8, p=1) and HKDF-SHA256. Authentication fails without the registered physical Ed25519 key, even if the password is correct.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Layer 4 HAProxy PROXY Protocol v1 &amp;amp; v2 Support
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Nodes operating behind Layer 4 reverse proxies (HAProxy, Nginx Stream, AWS NLB) transparently resolve real client IP addresses and ports (&lt;code&gt;realRemoteAddress&lt;/code&gt;, &lt;code&gt;realRemotePort&lt;/code&gt;) with &lt;code&gt;USE_PROXY_PROTOCOL=true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Supports both US-ASCII text PROXY v1 (&lt;code&gt;PROXY TCP4/TCP6/UNKNOWN&lt;/code&gt;) and 12-byte binary magic PROXY v2 with zero external libraries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IP Spoofing Immunity:&lt;/strong&gt; Only proxies specified in &lt;code&gt;PROXY_TRUSTED_IPS&lt;/code&gt; (default: &lt;code&gt;127.0.0.1,::1&lt;/code&gt;) are authorized. Unauthorized spoofing attempts are instantly rejected with immediate socket termination (&lt;code&gt;status: REJECT&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparent Passthrough:&lt;/strong&gt; Direct connections without PROXY headers have unparsed bytes restored (&lt;code&gt;socket.unshift(remainder)&lt;/code&gt;) and route seamlessly to federation, SSH, or Telnet handlers with zero data loss.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To see the full installation guide, deployment models, and deployment via Docker, check out the official repository:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Full Documentation &amp;amp; Source Code:&lt;/strong&gt; &lt;a href="https://github.com/GokturkA1/metrice" rel="noopener noreferrer"&gt;https://github.com/GokturkA1/metrice&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>security</category>
      <category>distributedsystems</category>
    </item>
  </channel>
</rss>
