Repository navigation
swift: add TailcatKit on the upstream C API - #64
Merged
Merged
Conversation
9 tasks done
josuediazflores
force-pushed
the
swift-bindings
branch
from
September 3, 2026 02:50
af99ac8 to
79719da
Compare
Member
|
I'd like a C expert to review this API first. This is why I also haven't merged my early #6 That said, it's probably pretty close since both were modeled on libtailscale's API. |
Member
|
Of 3 pending PRs, I ended up going with the C API from #130. But that didn't add Swift. Could you rebase/redo your Swift work atop that API? |
This adds a Swift package (TailcatKit) wrapping the cmd/libtailcat C API, along with a demo program, tests that run against a local DERP/STUN relay, and a macOS CI job that builds the XCFramework and compiles for iOS devices and the simulator.
bradfitz
force-pushed
the
swift-bindings
branch
from
November 18, 2026 19:34
980040e to
af98f83
Compare
The iOS xcodebuild step fails on macOS 26 runners with "does not contain a scheme named TailcatKit". Run xcodebuild -list first so the package schemes get generated, and so the log shows which schemes xcodebuild sees.
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.
This reworks the Swift bindings on the C API merged in #130, as requested in the latest maintainer feedback. The previous
libtailcat/implementation is removed; the diff against current main adds only the Swift package and its README entry.TailcatKitprovides Swift 6 async servers, clients, listeners, and TCP connections for macOS 14+ and iOS 17+. It uses the upstream opaque handles, per-operation error strings, cancellation/deadline tokens, andtc_freeownership rules. Swift task cancellation interrupts pending C calls, while all blocking operations and resource teardown run off actor executors.The Apple build scripts now package
cmd/libtailcatand its public header asCTailcat.xcframework. Tests run against a local DERP/STUN relay and cover cancellation/reuse, half-close, partial writes, listener/connection ownership, key bundles, and address metadata. The README documents API changes including ephemeral listen port zero, idempotent startup, async close, and the upstream key format.Validation:
go test ./...go test -race ./internal/capi ./cmd/libtailcatmake -C swift testwith Swift warnings treated as errorsxcodebuildbuildsThe XCFramework remains a local build output; binary release distribution and UDP wrappers are not included.