Repository navigation
FMSG-006 indicators over UDP 4930 - #53
Merged
Merged
Conversation
Listen for indicator datagrams on UDP at the TCP address and port, and
send local participants' indicators from the same socket.
Receiving drops a datagram at the first failing step: a per-source rate
limit (50/s, burst 100); parsing (version 1, exact fields, data empty or
a single emoji of at most 64 bytes); the subject by hash, as a message or
an add-to batch message; the participant index in that subject's exact
wire header, which must not be on this host's domain; and the source
address against fmsg.<domain> (cached 60s, skipped with
FMSG_SKIP_AUTHORISED_IPS). An accepted indicator, ttl clamped to 120, is
published on the PostgreSQL NOTIFY channel "indicator" as
{"id","from","emoji","ttl"} for the client API to deliver.
Sending LISTENs on the same channel. For an address this host hosts, it
picks per remote participant domain the subject that domain holds and
the indicating participant is in (the original, else the first add-to
batch with both), uses the lowest index, and sends to one address of
fmsg.<domain>, alternating. At most one datagram per subject and index
every 2s, coalescing to the latest; clears go at once; at most 20 per
second per receiving domain.
FMSG_INDICATORS=false or 0 turns both off. The emoji package is the one
used for FMSG-005 reactions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements FMSG-006 Indicators host to host, paired with markmnl/fmsg-webapi#64.
Receive (UDP on the TCP listen address and
FMSG_PORT), following the spec's steps in order and dropping silently at the first that fails:internal/emoji) of at most 64 bytes.msg.sha256, then bymsg_add_to_batch.sha256. Participants are read from that row's stored wire header (From, To, then AddToFrom and AddTo for a batch), not fromloadMsg, which merges batches.fmsg.<that domain>, using a 60 s indicator-only DNS cache.FMSG_SKIP_AUTHORISED_IPSis honoured.NOTIFY indicatorwith{id, from, emoji, ttl}for the web API's hub.It never replies and never stores anything.
Send:
pq.Listeneronindicator. It ignores notices whosefromthis host doesn't serve, which is the loop guard.from: the original, else the first add-to batch with both. The index isfrom's lowest position.WriteTo) toFMSG_REMOTE_PORT, alternating between the domain's addresses. ICMP is ignored.FMSG_INDICATORS=falseturns both directions off. If the UDP bind fails, fmsgd logs it and keeps TCP running.Tests:
go test -race ./...andgo vetpass. README: new section, plusFMSG_INDICATORS. Firewalls need UDP 4930 in and out.Notes:
isIndicatorLocalDomainis the one function to change for a multi-domain host.🤖 Generated with Claude Code