macula_advertise_station (macula v4.2.3)
View SourcePeriodic DHT advertisement of a macula-net station.
Mirrors the shape of macula_dist_discovery: build a signed record once, publish it via a caller-supplied put_fn, refresh on a timer at well below the record's TTL.
Phase 2 publishes two record kinds per call:
- One
macula_record:station_endpoint/3— keyed undersha256("station_endpoint" || pubkey)— telling resolvers how to reach the station's QUIC port. - One
macula_record:address_pubkey_map/3per macula-net address the station hosts — keyed undersha256("address_pubkey_map" || addr)— letting resolvers turn a bare IPv6 into a station pubkey.
The put_fn decoupling lets the same code drive co-located deployments (where the relay's internal API is reachable) and client-only deployments (where a V2 macula_client:pool() is the right primitive). PLAN_MACULA_NET_PHASE2.md §4.1 / §5.
Summary
Functions
Return the most recently published record set.
Force an immediate re-advertise. Useful from tests.
Types
-type config() :: #{realm_pubkey := <<_:256>>, identity_pubkey := <<_:256>>, identity_privkey := macula_identity:key_pair() | macula_identity:privkey(), quic_port := 1..65535, addresses := [<<_:128>>], put_fn := put_fn(), advertised_ips => [binary()], alpn => binary(), refresh_ms => pos_integer()}.
-type put_fn() :: fun((macula_record:record()) -> ok | {error, term()}).
Functions
-spec current_records() -> [macula_record:record()].
Return the most recently published record set.
-spec refresh_now() -> ok.
Force an immediate re-advertise. Useful from tests.
-spec stop() -> ok.