Repository navigation
feat(apple): read peers' Hostinfo.App and admit by the tag first (T8, the Swift read half) - #245
Merged
Merged
Conversation
… the Swift read half)
- BackendPeer gains `app`, the peer's Hostinfo.App.
- Hostname.isAppRow(hostname:app:appId:) mirrors provider.rs::is_app_row: a
present tag must be exactly truffle:{appId}, whatever the name; an untagged
or empty-tagged row falls back to the truffle-{appId}- prefix. Admission
(MeshNode upsertFromLayer3) and the login-gate notice use it in place of
isAppPeer.
- TailscaleKit's PeerStatus binding drops Hostinfo.App, so the iOS backend
reads it over the LocalAPI loopback it already uses for WhoIs and logins:
- the status-row decoder also keeps NodeID and HostName;
- GET /localapi/v0/peer-by-id?id=N is asked once per (node ID, hostname),
so a renamed peer is asked again;
- a failed read records nothing and is asked at the next refresh;
- a peer applies only the answer for its current hostname.
- PeerAppCache is pure (outside the iOS #if), so the macOS test target pins
it from literal JSON. LoopbackNetwork models a node's app (join(app:),
setApp).
- Not here: announcing a tag from the Swift node, or a Swift prefix. Both
need a libtailscale export of hostinfo.SetApp and a new TailscaleKit. The
Swift node keeps truffle-{appId}-…, which every release admits.
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.
What
The Swift node reads each peer's
Hostinfo.Appand admits app peers by that tag first, by thetruffle-{appId}-prefix only for an untagged row. This is the Apple plane's half of #243 (sidecar protocol 12). A Swift node now sees a
desktop that chose its own hostname prefix.
BackendPeergainsapp.Hostname.isAppRow(hostname:app:appId:)mirrorsprovider.rs::is_app_row:truffle:{appId}, whatever the name.isAppPeeratMeshNodeadmission (upsertFromLayer3) and in the login-gate notice.IpnState.PeerStatusbinding has noHostinfo.App, and the status JSON has none either. So the iOSbackend reads it over the LocalAPI loopback it already uses for WhoIs and the login overlay:
NodeIDandHostName.GET /localapi/v0/peer-by-id?id=Nreturns the peer'stailcfg.Node, whoseHostinfo.Appcontrol relays to peers(measured on a real tailnet for feat(core): an app-chosen hostname prefix, with app membership from Hostinfo.App (sidecar protocol 12) #243: a peer's row keeps App, Hostname, OS and Services).
PeerAppCacheis pure and lives outsideTailscaleKitBackend.swift's#if os(iOS) && canImport(TailscaleKit), asLocalAPIIdentitydoes, so the macOS test target pins it.LoopbackNetworkmodels a node's app (join(app:),setApp).Additive:
BackendPeer.init's new parameter has a default.Not here (held)
Announcing a tag from the Swift node, and a Swift hostname prefix.
hostinfo.SetApphas no environment knob, and libtailscale exports no setter.apple/patches/patch (a cgo export callinghostinfo.SetApp) and a rebuiltTailscaleKit.xcframework, published under a new dependency-keyed release, with the rootPackage.swiftURL andchecksum moved together.
truffle-{appId}-…, which every release admits by the prefix.Rollout: the chain before an app turns a desktop prefix on
A Swift peer must read the tag, so the chain (VibeField's, for its phone) is:
Only then may the desktop's
hostname_prefixgo on.Tests
The tests were written first and run red against stubs, an
isAppRowthat ignored the tag and an empty cache:NodeID/HostName,peer-by-id'sApp) passed, as wire facts should.New:
HostnameAppRowTests:appTagistruffle:{appId}.NodeLoginGateTests.aTaggedPeerIsAdmittedByItsTagNotItsName(loopback):vibefield-studiotaggedtruffle:demois admitted;truffle-demo-mallorytaggedtruffle:chatis not;vibefield-oldis not, until it announces the tag.PeerAppTagsTests:NodeIDandHostName, and the login overlay still reads them;peer-by-idyields the app (absent, empty and no-Hostinfo all givenil);nil, and departed peers are forgotten.Run locally at this commit:
swift test(root manifest): 115 tests in 19 suites passed.swift testinapple/(the shim, with a copied, gitignored TailscaleKit): 115 passed.xcodebuild -scheme TruffleTailscale -destination 'generic/platform=iOS' build CODE_SIGNING_ALLOWED=NO: BUILDSUCCEEDED.
generic/platform=iOS Simulator: BUILD SUCCEEDED. Both compileTailscaleKitBackend.swiftandPeerAppTags.swift, with no new warnings.Not run here: a device against a live tailnet. The
peer-by-idpath is the LocalAPI tsnet serves at v1.104.1, theversion the sidecar's own
PeerByIDread uses in #243.Petition: VibeField's T8, the Apple plane's half A.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.