Repository navigation
swift: add TailcatKit on the upstream C API - #64
Open
josuediazflores wants to merge 8 commits into
Open
josuediazflores wants to merge 8 commits into
josuediazflores wants to merge 8 commits into
Conversation
9 tasks done
With CGO_ENABLED=0 the file that imports "C" drops out of the build but the helper files did not, leaving a package main with no main function. Constrain every file on cgo so the package is skipped instead.
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 branch has not been deployed
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.