41 Commits

Author SHA1 Message Date
zhangdongya
cab04836d0 libtailscale: fix build with apple clang. 2025-05-23 16:29:47 -04:00
Jonathan Nobels
0629602630 workflows: add TailscaleKit tests to CI
updates tailscale/tailscale#15802

Updates the tests to run using go 1.24 and
adds a CI run to build the swift/TailscaleKit
targets and tests.
2025-05-22 12:18:39 -04:00
Jonathan Nobels
727bd68619 swift: add iOS simulator support
updates tailscale/tailscale#15802

This adds the required targets to build for the iOS
simulator.   We support both ios, ios-sim, and ios-fat
framework targets.

The sample app is updated to link in the ios-fat version
so it can be run on any target device or sim.
2025-05-22 10:50:34 -04:00
Jonathan Nobels
78294ac1d6 swift: add public methods for published states and update docs
updates tailscale/tailscale#15802

The connection states weren't public.  These are now exposed as
AsyncSequences so that there's no public dependency on Combine.

Documentation cleanup up and clarified slightly.  Some minor
reorganization of localAPI.   Adds a test to ensure that localAPI
is functional.

Add the xcode equivalent of -wall -werror
2025-05-05 15:11:04 -04:00
Jonathan Nobels
66906566f8 swift: fix proxy settings
updates tailscale/tailscale#15802

Updates the proxy settings.  These more modern constants
work with both macOS and iOS, for both localapi and
NSURLConnection socks to tailnet URLs
2025-05-02 17:05:53 -04:00
Jonathan Nobels
0b970d454c swift: remove signing from TailscaleKit builds
updates tailscale/tailscale#15802

make ios and make macos for TailscaleKit should build unsigned frameworks.

This also removes the kCFNetworkProxiesHTTPSEnable flag for iOS which
is not available.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-04-28 12:59:55 -04:00
Sam Mikes
46d5a2d665 Drop explicit path to go binary
Signed-off-by: Sam Mikes <smikes@cubane.com>
2025-04-27 16:03:11 -07:00
Jonathan Nobels
d5a3c8e8ef swift, go.mod: adding localAPI support via SOCK5
updates tailscale/tailscale#13937

This adds localAPI support into TailscaleKit.  LocalAPI can now be queried
via the SOCK5 proxy on both MacOS and iOS.   This also fixes SOCKS5
support for iOS so you can simply apply our config to a URLSession.

This pulls in most of LocalAPI - though much of it is untested, it's based
on the implementation in tailscale/corp/xcode.

Unit tests pending.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-04-25 11:55:09 -04:00
Jonathan Nobels
a6f9249de0 swift: add public modifiers to methods/types that need to be public
updates tailscale/tailscale#13937

A few of the initializers and related types on the Listener and Connection
types were default-internal and must be public.
2025-03-25 10:25:55 -04:00
Jonathan Nobels
40f559c067 Makefile/swift: update Makefile and add support for iOS
updates tailscale/tailscale#13937

Adds a Makefile for building various targets.  Adds support for building
iOS compatible libtailscale_ios.a.   Removes SOCKS5 support for iOS where
it looks like the CFNetwork support is lacking.

Fixes a few unexported symbols in TailscaleKit.

Added macOS sample app.
2025-03-24 14:01:54 -04:00
Yagil Burowski
9d45e587f0 Add tailscale_enable_funnel_to_localhost_plaintext_http1 to tailscale.h 2025-01-21 08:12:46 -08:00
Christoph
75f9bc2786 Update echo_server.c
Add the missing framework that macOS needs to the comment
2025-01-16 13:51:16 -08:00
Jonathan Nobels
2948fe1136 swift: add NWConnection-inspired Swift 6 compatible Tailscale.framework
updates tailscale/tailscale#13937

Builds a TailscaleKit.framework which wraps libtailscale.a in an actor,
providing IncomingConnection, Listener, and OutgoingConnection
types which are more usable in pure async Swift code.  The
method signatures are intended to be similar in form to NWConnection.

We also provide an extension to URLSession so you can make URL
requests via the user-space proxy.

Adds a static library mirroring much of the test control utilities in go, minus
the dependency on testing, so that we can export the signatures and
link it to tests that cannot run in go.

Added functionality to get both the local interface IPs as well as
the remote IP of  incoming connections accepted by a listener.

Fixed a bug in the log writer so we append a newline.

This also updates to the latest go toolchain and tailscale version.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-01-02 14:35:20 -05:00
James Tucker
9095651d2d sourcepkg: add a complete source package build
There is a makefile that will produce a libtailscale.tar.zst. This
archive contains a vendored Go source tree for libtailscale, and a
`configure` and `Makefile` that will produce a .so, a .a, and a .pc file
for building & linking against.

Updates tailscale/tailscale#8912
2023-08-29 11:56:40 -07:00
James Tucker
7c1e4de0fc go.mod: bump to recent tailscale and gvisor
This adds compatibility for go1.21.

Updates #cleanup
2023-08-16 11:43:53 -07:00
David Crawshaw
5cade0d40d libtailscale: make header compatible with c++ 2023-03-18 17:44:38 -07:00
David Crawshaw
b0e2f4a4e4 libtailscale: make tailscale_listener pollable
Use a socketpair(2) and sendmsg/recvmsg to pass a connection fd
from Go to C. This lets people write non-blocking C by polling on a
tailscale_listener for when they should tailscale_accept.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-18 15:04:28 -07:00
David Crawshaw
42597d5fb7 go.mod, go.sum: update tsnet
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-18 15:04:28 -07:00
David Crawshaw
14119d858c libtailscale: match close semantics, remove race
It is theoretically possible for separate calls to tailscale_close to
race and cause a mess, so move the load+delete under a single mutex
lock.

While here, give it the closer error semantics to tailscale_listener_close.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-12 10:23:01 -07:00
David Crawshaw
9bf2df1ab1 libtailscale: EBADF on bad tailscale_listener_close fd
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-11 16:53:35 -08:00
David Crawshaw
ae40e7a7f7 go.mod, go.sum: update tsnet
Attempt to understand most recent CI failure:
https://github.com/tailscale/tailscale/issues/7488

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-07 19:54:59 -08:00
James Tucker
44ef74417c libtailscale: implement shutdown semantics for conns
On connections where it applies, signal to the peer connection that the
connection is shutting down/half closed, and only fully close once both
sides are complete.
2023-03-07 14:54:57 -08:00
James Tucker
acbc2e40b6 libtailscale: remove double-close on connections
If a client program receives the fd then it is responsible for closing
the fd, and we must not close the fd, as we may end up closing the wrong
object.
2023-03-07 14:54:57 -08:00
David Crawshaw
926893f68c libtailscale: take a C.int, not a Go int
This was compiling because of the implicit integer conversion on the C
side. But -1 was becoming INT32MAX. Which was an invalid fd, so the logs
were hidden just as if the fd were -1. But it filled strace with EBADF.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-07 12:36:29 -08:00
David Crawshaw
56cb66829f libtailscale: call hostinfo.SetApp
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-07 09:36:31 -08:00
David Crawshaw
843d93cb63 libtailscale: update tailscale_loopback
This brings it inline with the tsnet change to support proxies.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-06 11:58:20 -08:00
David Crawshaw
30ea07bf54 go.mod, go.sum: update tsnet
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-06 11:58:20 -08:00
Shayne Sweeney
2df6a30f8a python: add initial support for Python
Signed-off-by: Shayne Sweeney <shayne@tailscale.com>
2023-03-05 14:49:12 -05:00
James Tucker
7bb5e96b97 ruby: add initial support for making local API requests 2023-03-03 16:57:51 -08:00
James Tucker
2b8dc03747 ruby: remove unnecessary artifacts from distribution 2023-03-03 16:57:51 -08:00
David Crawshaw
72c10539e2 libtailscale: add tailscale_loopback_api function
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-02 16:09:43 -08:00
David Crawshaw
998fdc4759 go.mod, go.sum: update tailscale.com/tsnet
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-02 16:09:43 -08:00
James Tucker
775ee41f1d ruby: add a gem that wraps the library 2023-03-02 11:07:17 -08:00
David Crawshaw
0f378c01bd .github: add CI tests
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-02 07:44:20 -08:00
James Tucker
13c8b27dd1 LICENSE: add common 3-clause license we use 2023-03-01 20:22:42 -08:00
James Tucker
1b54d72e9a tailscale.h: remove non-implemented addr funcs 2023-03-01 17:39:55 -08:00
David Crawshaw
0dc2f30930 libtailscale: Tailscale C library 2023-03-01 08:21:28 -08:00
David Crawshaw
0b08c888b9 go.mod, go.sum: initialize
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-03-01 08:21:28 -08:00
David Crawshaw
5a373bd82b .gitignore: add 2023-03-01 08:21:28 -08:00
David Crawshaw
ea6055573e README.md: add build details 2023-03-01 08:21:28 -08:00
David Crawshaw
7eccb62105 README.md: initial commit
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2023-02-20 17:00:17 -08:00