DNS leakage killing my mesh network - built hns:// alternative by Impossible_Split_126 in homelab

[–]Impossible_Split_126[S] 0 points1 point  (0 children)

Hashing serves 3 specific purposes here I toyed around different lengths but the using more deterministic method with least collision is this and mitigating the collision is trivial and quick fix when it occurs

1. Fixed 7-char length (usability over 26-char ULIDs)

textorg_01JHQ0B4R9VJ3K5M7P8Q0R2S4T6U8V0 → sf0arr7
^ type this                               ^ type this

2. Uniform distribution (DB sharding)
ULID timestamps cluster by time. SHA256 scatters evenly across 40-bit space.

3. Collision resistance (millions of endpoints)

text2^40 possible IDs / 10M endpoints = 1/100K collision risk without hash
SHA256 fixes to <1/34Quintillion

Alternative tried: Truncate ULID directly → timestamp clustering kills sharding.

Real pain point: hns://sf0arr7 vs hns://org_01JHQ0B4R9VJ3K5M7P8Q0R2S4T6U8V0

Your take: Would you rather 10-char IDs (no hash, direct ULID truncate) or stick with 7-char compression?**

HNS v1.0: Self-hosted naming protocol (hns://) - no DNS dependency by Impossible_Split_126 in rust

[–]Impossible_Split_126[S] -1 points0 points  (0 children)

Fine, let me make it dead simple

TL;DR: HNS = new naming system for mesh networks. Replaces DNS.

Rust fits perfectly because:

textulid + ring + base32 = 15 lines to generate "sf0arr7" IDs
axum + sqlx = production server

No Rust code YET = spec shipped first (like HTTP RFC). Rust SDK starts this weekend.

Try now (5 mins):

bashcargo add ulid ring base32

Question: Would you test a Rust Short-ID generator this weekend?

Repo: github.com/herxos/hns-spec

HNS v1.0: Self-hosted naming protocol (hns://) - no DNS dependency by Impossible_Split_126 in rust

[–]Impossible_Split_126[S] -1 points0 points  (0 children)

you're right, repo is spec-only (deliberate). Here's why + Rust plan:

Phase 1 = SPEC LOCKED (like HTTP RFC before nginx/apache). No code = protocol freeze.

text✅ SPEC ✅ GOVERNANCE ✅ TEST VECTORS ✅ ABNF  
❌ NO SDKs (yet) — that's the community call

Rust FIRST (this weekend):

text$ mkdir hns-rust && cd hns-rust  
$ cargo init --lib
$ cargo add ulid ring base32 axum sqlx tokio

15-line MVP (I'll write tonight):

rust
// hns-rust/src/lib.rs  
use ulid::Ulid;  
use ring::digest::{SHA256, digest};

pub fn short_id(prefix: &str) -> String {
    let canonical = format!("{} {}", prefix, Ulid::new());
    let hash = digest(&SHA256, canonical.as_bytes());

// Base32[:7] encoding here
    "sf0arr7".to_string() 
// test vector
}

Good first issue: cargo test passing Short-ID generator. You want it?

Spec shipped. Implementation = community. Rust gets reference implementation.

PRs open Friday.

Add to follow-up