IVNP is an I2P network router and application stack written in Go. It operates either as a standalone daemon (ivnpd) with built-in proxy and management services, or as an in-memory embedded Go library (gosuda.org/ivnp) that exposes standard net.Conn, net.Listener, and net.PacketConn primitives over destination-owned garlic circuits.
Requires Go 1.27+.
- Dual Execution Model: Run a persistent network router daemon via
ivnpd, or embed a zero-disk-footprint router directly inside a Go process viaivnp.NewRouter. - Modern I2P Transport & Crypto Stack: Full implementations of NTCP2 (TCP with AES-256-CBC ephemeral key obfuscation and SipHash-2-4 frame length masking) and SSU2 (UDP with ChaCha20 header protection, stateless retry tokens, persisted
NewTokenwarm reconnects, 7-message peer testing, introducer hole punching, and outbound-only per-peer connected UDP sockets with zero wildcard listeners), plus dedicated-network (netId != 2, official IVNPnetId = 105) non-ratcheting VTLS (TLS 1.3 TCP) and VQUIC (QUIC v1 UDP) transports inspired by XTLS's REALITY with zero added Go dependencies, two-gear anti-open-proxy fallback throttling, a versioned 49-slot class-bitset SNI catalog with deterministic per-relay auto-pinning, single-port multi-netIdTCP/UDP multiplexing (SharedPortMux), and heterogeneous protocol-set negotiation across any subset of{VQUIC, VTLS, SSU2, NTCP2}. - Post-Quantum & Ratchet End-to-End Sessions:
ECIES-X25519-AEAD-Ratchet(Noise_IKelg2+hs2_25519_ChaChaPoly_SHA256) alongside FIPS-203 ML-KEM-768 and ML-KEM-1024 hybrid post-quantum LeaseSet2 encryption (CryptoKeyType6 and 7), with zero-ElGamal-math Proposal 144 destination key generation. - Blinded & Authorized LeaseSets: Full support for
LeaseSet2,MetaLeaseSet, local-onlyDialOnlyLeaseSet2, and two-layer ChaCha20EncryptedLeaseSetwith RedDSA (Red25519) daily key blinding and per-client Diffie-Hellman (DH) or Pre-Shared Key (PSK) access control. - Multi-Network Contexts, Official Dual-Homed IVNP Preset, Dial Schedules & Live Roaming: Bind a single
ivnp.Destinationidentity across the official IVNP dedicated overlay (ivnp_net,netId=105), the public I2P network (i2p,netId=2), private meshes (directwith0-hoptunnels,dedicatedwith1-hoptunnels), and zero-listener end-user client contexts (clientwith0-hop out / 1-hop in,ParticipationClient, and NAT-preserving keepalives).IVNPRouterConfigrunsivnp_net(105) andi2p(2) on one shared TCP/UDP port with zero public leakage, whileWithPortGroup(group)shares one TCP/UDP port across a named subset of networks.DefaultDestinationConfig()inherits all configured router networks and their profile defaults automatically;DialStreamsupports Happy Eyeballs (250msfallback delay) as well as declarative per-network dial schedules (WithDialSchedule,DialLeg,DialAdvanceFastFail), andWithMigrationDomain+ pluggableRoutePolicy(BalancedRoutePolicy,LowestLatencyRoutePolicy,PreferNetworkOrderRoutePolicy,FailoverOnlyRoutePolicy, or customRoutePolicyFunc) roam active streams seamlessly across explicitly paired networks with zero connection drops.Routeralso exposesListenAddrs,UpdateAdvertisedAddrs,WithSocketControl, andNotifyNetworkChangefor OS network-transition hooks and multi-interface socket binding, and streams support abortiveReset()(ErrStreamReset). - Compile-Time Datagram Authentication Separation:
Destination.ListenPacketserves only cryptographically authenticated protocols (Datagram1and target-boundDatagram2) and implementsnet.PacketConn. Unauthenticated protocols (RawandDatagram3) requireDestination.ListenUnauthPacket, preventing callers from mistaking a spoofable source hash for a verifiednet.Addr. - Complete Client Protocol Suite: Built-in SAM v3.3 bridge (
STREAM,DATAGRAM,DATAGRAM2,DATAGRAM3,RAW,PRIMARYsubsessions, and offline signatures), HTTP/HTTPS-CONNECT eepsite and outproxy gateway, SOCKS5 proxy, and a lock-free AddressBook resolver with conditional ETag subscriptions. - Strict Layered Architecture & Zero-Allocation Wire Codecs: Enforced 10-layer unidirectional dependency graph (
L0throughL9) backed bywire.Cursorzero-copy parsers, I2P-aligned slab pools, and deterministictesting/synctestnetwork simulation (internal/simnet).
Each GitHub Release publishes reproducible static ivnpd binaries (with the embedded WebUI) for linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64, and windows/arm64, alongside SHA256SUMS, a Sigstore provenance bundle (ivnpd-<VERSION>.sigstore.json), and multi-architecture Distroless OCI images (ghcr.io/gosuda/ivnpd and ghcr.io/gosuda/ivnp-reseed):
VERSION="v0.10.0"
ARCHIVE="ivnpd-${VERSION}-linux-amd64.tar.gz"
BASE="https://github.com/gosuda/IVNP/releases/download/${VERSION}"
curl -fsSLO "${BASE}/${ARCHIVE}"
curl -fsSLO "${BASE}/SHA256SUMS"
curl -fsSLO "${BASE}/ivnpd-${VERSION}.sigstore.json"
# Verify SHA-256 digest (use shasum -a 256 -c - on macOS):
grep " ${ARCHIVE}\$" SHA256SUMS | sha256sum -c -
# Verify SLSA v1.0 Build Level 2 provenance:
gh attestation verify "${ARCHIVE}" \
--bundle "ivnpd-${VERSION}.sigstore.json" \
--repo gosuda/IVNP \
--signer-workflow gosuda/IVNP/.github/workflows/release.yml \
--source-ref "refs/tags/${VERSION}" \
--deny-self-hosted-runners
tar -xzf "${ARCHIVE}"
./"ivnpd-${VERSION}-linux-amd64/ivnpd" -config ivnp.confBrowse all published build provenance records at GitHub Attestations, or reproduce any binary locally from a tagged checkout with ./scripts/repro-build.sh ./dist/ivnpd ./cmd/ivnpd.
go install gosuda.org/ivnp/cmd/ivnpd@latest
ivnpd -config ivnp.confOr run directly from a source checkout:
go run ./cmd/ivnpd -config ivnp.confTo run an ephemeral daemon in memory without writing configuration, keys, or NetDB state to disk:
ivnpd -memory| Service | Default Bind Address | Protocol / Purpose |
|---|---|---|
| Web Console | http://127.0.0.1:7070 |
Operational console, SSE telemetry, 60-minute history, object views, and schema-driven INI editor |
| HTTP Proxy | 127.0.0.1:4444 |
.i2p eepsite proxy and clearnet outproxy forwarding (HTTP and CONNECT) |
| SOCKS5 Proxy | 127.0.0.1:4447 |
SOCKS5 CONNECT proxy for .b32.i2p and base64 destinations (enable with -socks5) |
| SAM v3.3 Bridge | 127.0.0.1:7656 (TCP) / 7655 (UDP) |
Simple Anonymous Messaging v3.1-v3.3 control and datagram sockets |
| Control API | 127.0.0.1:7650 |
Bearer-authenticated status, readiness, graceful drain, destination catalog, RouterInfo extraction, and manual peer import endpoints (/readyz, /status, POST /drain, /destinations, GET /router-info, POST /peers/import; opt-in) |
| Metrics & Probes | 127.0.0.1:9090 |
Dedicated Prometheus /metrics and /healthz, /livez, /readyz listener (opt-in; /healthz, /livez, /readyz, /varz are also served on :7070, where /varz requires the WebUI token when one is set) |
On first start with the default -config ivnp.conf path, ivnpd creates ivnp.conf (0600) if absent and stores AES-256-GCM encrypted router state (router.state), master keys (router.keys), and NetDB snapshots under ./data. On Unix-like systems, ivnpd refuses to load a configuration file or a [reseed] trusted_cert_files entry that is group- or world-writable (any mode bit in 0o022); fix such a file with chmod go-w.
[paths]
data_dir = /var/lib/ivnp
[network]
id = 2
profile = public ; public | dedicated | direct | client
[router]
floodfill = false
transit = true
[http_proxy]
enabled = true
listen_host = 127.0.0.1
listen_port = 4444
outproxies = exit.stormycloud.i2p
[sam]
enabled = true
listen_host = 127.0.0.1
listen_port = 7656
udp_host = 127.0.0.1
udp_port = 7655Common CLI flags:
-config <path>: Path to INI configuration file (defaultivnp.conf).-memory: Run in-memory without reading or writing persistent state on disk.-data-dir <dir>: Override[paths] data_dir.-webui=false/-webui-listen <addr:port>: Disable or rebind the embedded WebUI server.-webui-auth/-webui-token <secret>: Require Bearer authentication on/api/*and/varz(or setIVNPD_WEBUI_TOKEN).-webui-auth=falsedrops only the token: without-webui-allowed-hosts, a loopback listener serves only loopback clients and loopbackHostnames, and a non-loopback listener accepts onlylocalhostor IP-literalHostheaders.-webui-allowed-hosts <hosts>: Comma-separated exact publicHostnames allowed for reverse-proxied WebUI access. When set on any listener, non-loopbackHostheaders must match an entry exactly. Adding any non-loopback host enforces a>= 16-byte Bearer token by default and classifies every request on that listener as remote.-webui-remote-write: Permit WebUI configuration writes, rollbacks, peer imports, and router restarts from non-loopback or reverse-proxied clients.-webui-show-peers: Expose peer router.b32.i2pidentities in/api/tunnels,/api/peers, and/api/router-infofor non-loopback or reverse-proxied clients.-http-proxy/-socks5: Enable or disable proxy listeners from the command line.-log-level <debug|info|warn|error>/-log-format <text|json>: Configure structured logging (SIGHUPreloadslog.levelat runtime on Unix).-graceful-shutdown <duration>: Override[router] graceful_shutdown_timeout(0s..15m) to reject new participating transit builds while letting active participating tunnels expire before exit (a secondSIGINT/SIGTERMaborts drain immediately).-healthcheck <url>: Query a local health endpoint and exit0on HTTP200or1otherwise (used by Distroless container healthchecks).-test-config: Validate configuration syntax and security invariants, then exit.
go get gosuda.org/ivnpivnp.NewRouter starts local router infrastructure in memory by default (cfg.Persistence == nil). A Router owns transport listeners, NetDB state, and exploratory tunnels; it never creates an implicit application identity. Application traffic flows through explicit ivnp.Destination instances.
package main
import (
"context"
"fmt"
"net"
"time"
"gosuda.org/ivnp"
)
func runService(ctx context.Context) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Minute)
defer cancel()
cfg := ivnp.I2PRouterConfig()
router, err := ivnp.NewRouter(ctx, cfg)
if err != nil {
return err
}
defer router.Close()
// NewDestination inherits router networks and profile defaults, builds
// inbound/outbound client tunnels, and confirms LeaseSet2 publication.
dest, err := router.NewDestination(ctx, ivnp.DefaultDestinationConfig())
if err != nil {
return err
}
defer dest.Close()
listener, err := dest.ListenContext(ctx, "i2p", ":8080")
if err != nil {
return err
}
defer listener.Close()
fmt.Println("Listening on:", net.JoinHostPort(dest.B32(), "8080"))
// Dial a remote .b32.i2p address directly over I2P streaming:
conn, err := dest.DialContext(ctx, "i2p", net.JoinHostPort(dest.B32(), "8080"))
if err != nil {
return err
}
defer conn.Close()
return nil
}IVNPRouterConfig composes IVNPNetwork() (ivnp_net, netId = 105, with VQUIC, VTLS, NTCP2, and SSU2, automatic SNI class pinning, and the default reseed endpoint https://hotseed.gosuda.org/i2pseeds.su3?netid=105, disableable with WithDisableReseed()) alongside I2PNetwork() (i2p, netId = 2, NTCP2 and SSU2 only) over one shared TCP port and one shared UDP port (SharedPorts = true). Pairing it with DefaultDestinationConfig() inherits both networks and their respective tunnel profiles automatically while keeping routing tables and RouterInfo records isolated:
bind := netip.MustParseAddrPort("0.0.0.0:443")
cfg := ivnp.IVNPRouterConfig(
ivnp.WithAllNetworks(ivnp.WithListen(bind)),
)
router, err := ivnp.NewRouter(ctx, cfg)
if err != nil {
return err
}
defer router.Close()
// Inherits all router networks (ivnp_net 1-hop + public i2p 3-hop) with one .b32.i2p identity.
// ReadyAnyNetwork returns as soon as the fastest bound network converges.
// Opt-in DestinationOptions tune per-network hops and 0-hop direct-first Happy Eyeballs.
dest, err := router.NewDestination(ctx, ivnp.DefaultDestinationConfig(
ivnp.WithHopsOn(ivnp.NetworkNameIVNP, 1, 0),
ivnp.WithDirectFirstOn(ivnp.NetworkNameIVNP, 200*time.Millisecond),
))
if err != nil {
return err
}
defer dest.Close()
// DialStream runs Happy Eyeballs: ivnp_net first, i2p hedged after 250ms.
conn, err := dest.DialStream(ctx, net.JoinHostPort(remoteB32, "8080"))
if err != nil {
return err
}
defer conn.Close()
if info, ok := ivnp.ConnInfo(conn); ok {
fmt.Println("network:", info.Network, "path:", info.Path)
}DefaultDestinationConfig() inherits both the router's configured networks (use WithNetworks(...) to bind a subset) and each bound network's profile defaults (3-hop on public, 1-hop on dedicated, 0-hop on direct, 1-in/0-out on client). Explicit tunnel-shape presets (DedicatedDestinationConfig, DirectDestinationConfig, and ClientDestinationConfig) and router.NewDestination(ctx, cfg, opts...) also accept variadic DestinationOption modifiers. Similarly, I2PRouterConfig, IVNPRouterConfig, RouterConfig.With, and NewRouter accept variadic RouterOption modifiers (WithAllNetworks, WithNetwork, WithPersistence, WithLogger, WithLimits, WithResolver, WithDefaultNetwork, WithSharedPorts). Use WithHops(1, 0) for single-relay asymmetric routing without exposing router IPs in LeaseSet2, WithDirectOutbound to keep LeaseSet2 relay-only while attempting 0-hop direct outbound connections, or WithDirectFirst to publish a 0-hop direct lease ahead of relayed backups with Happy Eyeballs fallback. Custom overlays can also be composed directly with NewRouterConfig(primary, extra...), NewDedicatedNetwork, NewDirectNetwork (0-hop low-latency meshes), and NewClientNetwork (zero-listener outbound-only 0-hop out / 1-hop in clients). Calling dest.DialNetwork(ctx, "ivnp_net", addr) or dest.ListenNetwork(ctx, "ivnp_net", ":8080") targets a single named network, while dest.ListenStream(ctx, ":8080") returns a merged listener accepting connections from any bound network.
IVNP separates authenticated datagrams from spoofable datagrams at the type level:
// Authenticated Datagram2 (protocol 19, target-bound and replay-resistant):
// Implements standard net.PacketConn.
pktConn, err := dest.ListenPacketContext(ctx, "datagram2", ":9000")
if err != nil {
return err
}
defer pktConn.Close()
// Unauthenticated Datagram3 (protocol 20) or Raw (protocol 18):
// Returns *ivnp.UnauthPacketConn so callers explicitly handle unverified sources.
rawConn, err := dest.ListenUnauthPacketContext(ctx, "datagram3", ":9001")
if err != nil {
return err
}
defer rawConn.Close()IVNP enforces a strict 10-layer unidirectional Directed Acyclic Graph (DAG). Every package belongs to one layer (L0 through L9). Higher layers may import lower layers, but lower layers never import higher layers, and cross-subsystem imports must pass exclusively through each subsystem's root facade package.
┌────────────────────────────────────────────────────────────────────────────┐
│ L9 CLI & Integration Tests cmd/ivnpd, cmd/ivnp-reseed, tests/, sim_* │
├────────────────────────────────────────────────────────────────────────────┤
│ L8 Root Module Facade gosuda.org/ivnp (Router, Destination, Conn) │
├────────────────────────────────────────────────────────────────────────────┤
│ L7 Node Lifecycle node (Daemon, EmbeddedRouter, NetworkSpec) │
├────────────────────────────────────────────────────────────────────────────┤
│ L6 Client Services client (SAM v3.3, HTTP, SOCKS5, AddressBook) │
├────────────────────────────────────────────────────────────────────────────┤
│ L5 Control Plane controlplane (NetDB, Tunnels, Reseed, NAT) │
├────────────────────────────────────────────────────────────────────────────┤
│ L4 Data Plane dataplane (NTCP2, SSU2, Garlic, Streaming) │
├────────────────────────────────────────────────────────────────────────────┤
│ L3 Domain Interfaces & State interfaces/{destination,stream}, state │
├────────────────────────────────────────────────────────────────────────────┤
│ L2 Foundation & Telemetry foundation (Identity, I2NP, NetDB), │
│ observability (Registry, Prometheus, Health) │
├────────────────────────────────────────────────────────────────────────────┤
│ L1 Cryptography cryptography (X25519, Elligator2, ML-KEM, │
│ ChaCha20-Poly1305, ElGamal, Streebog) │
├────────────────────────────────────────────────────────────────────────────┤
│ L0 Internal Utilities internal/{wire,pool,packet,ingress, │
│ parallelism,relay,simnet} │
└────────────────────────────────────────────────────────────────────────────┘
Detailed architectural guides, codebase maps, and wire-level protocol references live under docs/:
| Document | Contents |
|---|---|
| Documentation Index | Reading guide and cross-reference map for the IVNP documentation suite |
| Architecture & Design Invariants | L0-L9 layered DAG rules, plane separation, CircuitToken lifetime draining, zero-allocation wire parsing, slab pooling, and encrypted state persistence |
| Codebase & Subsystem Guide | Package-by-package and file-by-file directory reference across all 10 layers, key types, and subsystem facades |
| Protocols, Wire Formats & Cryptography | cryptography and foundation: Elligator2, X25519, Red25519 blinding, ML-KEM-768/1024 hybrids, KeysAndCert wire layout, RouterInfo, LeaseSet2, EncryptedLeaseSet, and I2NP headers |
| Transports & Tunnels | NTCP2, SSU2, dedicated-network VTLS/VQUIC overview, header protection, NAT hole punching, peer test, 1024-byte AES-256-CBC tunnel framing, gateway fragmentation, endpoint reassembly, and STBM/VTBM tunnel builds |
| VTLS & VQUIC Protocol Specification | Official IVNP dedicated network (netId = 105), XTLS's REALITY-inspired TLS 1.3 (TCP) and QUIC v1 (UDP) wire specification, versioned 49-slot class-bitset SNI catalog and auto-pinning, two-gear anti-open-proxy fallback throttling, SharedPortMux single-port multiplexing, and multi-network ivnp-reseed segregation |
| Garlic, Streaming & Datagrams | ECIES-X25519-AEAD-Ratchet state machine, two-phase NewSession commit, I2P Streaming TCB, congestion control, and Datagram1/Raw/Datagram2/Datagram3 codecs |
| Control Plane & NetDB | Split Kademlia XOR NetDB, floodfill operations, iterative lookups, confirmed publication, paired tunnel pool maintenance, SU3 reseed verification, and UPnP/NAT-PMP port mapping |
| Client Services & Public API | Root Go API (gosuda.org/ivnp), SAM v3.3 server/client, HTTP & SOCKS5 proxies, AddressBook, and ivnpd WebUI REST/SSE API |
| Node Deployment Guide | Production deployment for dual-homed (i2p + ivnp_net) and ivnp_net-only relays/floodfills, SLSA v1.0 L2 binary verification, Linux isolation hardening, and identity backups |
| Private Networks, Presets & Tuning Guide | public, dedicated, direct, and client presets, complete raw parameter matrices, realistic deployment scenarios (end-user zero-listener apps, clipboard-sync sidecars, LAN meshes, multi-site overlays), and Go/INI tuning recipes |
| Verification, Simulation & Tooling | Standard test/lint commands, architectural DAG checks, deterministic simulation testing (simnet & dstoverlay), and live network integration tests |
| Subsystem Reference: L0-L3 (Utilities, Crypto, Foundation & State) | Code-level reference for internal/*, cryptography, foundation, observability, interfaces/*, and state (router.state binary bundle layout) |
Subsystem Reference: L4 (dataplane) |
Code-level walkthrough of DataPlane, Service, isolated 64-shard set-associative replay caches, GarlicReceiver, NTCP2Manager, SSU2Manager, VTLSManager, VQUICManager, SharedPortMux, and 64-shard tunnel.Runtime |
Subsystem Reference: L5 (controlplane) |
Code-level walkthrough of Controller, isolated destinationRuntime, StreamingTunnelSender, OBEP replyRouterInfoSeeds, NetDB, and STBM/VTBM tunnel builders |
| Subsystem Reference: L6-L9 (Services, Node, Root API & CLI) | Code-level walkthrough of client, node, root gosuda.org/ivnp files, cmd/ivnpd, cmd/ivnp-reseed, and tools/dstoverlay |
Reseed Server Manual (ivnp-reseed) |
Autonomous DHT crawler, TCP prober, Max-Min XOR peer selector, deterministic RSA-4096 SU3 packager, and HTTP server |
See CONTRIBUTING.md for code verification requirements and how to contribute by running a relay or floodfill node (docs/node-deployment.md).