- Add README.md and CHANGELOG.md (required by pub.dev) - Add .pubignore / ios/.pubignore to include xcframework in published package - Add Gitea Actions workflow: builds xcframework and publishes on release - Release tag must match pubspec version with no v prefix (e.g. "0.1.0") - Requires PUB_TOKEN secret in Gitea repo settings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
1.7 KiB
Markdown
62 lines
1.7 KiB
Markdown
# tsnet_flutter
|
|
|
|
Embed [Tailscale's tsnet](https://pkg.go.dev/tailscale.com/tsnet) in Flutter apps. Provides a userspace WireGuard tunnel with a localhost TCP proxy — **no VPN entitlement needed** on iOS.
|
|
|
|
## How it works
|
|
|
|
```
|
|
Flutter (Dart) → MethodChannel → Swift Plugin → Go static library (tsnet)
|
|
↓
|
|
WireGuard tunnel (userspace)
|
|
↓
|
|
Remote device (100.x.x.x)
|
|
```
|
|
|
|
The Go layer runs a local TCP proxy: your app connects to `localhost:PORT`, and traffic is forwarded through a WireGuard tunnel to the target device's Tailscale IP. Flutter doesn't know about Tailscale — it just sees a localhost port.
|
|
|
|
## Usage
|
|
|
|
```dart
|
|
import 'package:tsnet_flutter/tsnet_flutter.dart';
|
|
|
|
final tsnet = TsnetFlutter();
|
|
|
|
// Join the Tailnet
|
|
await tsnet.start(authKey: 'tskey-auth-...');
|
|
|
|
// Create a local proxy to the remote device
|
|
final localPort = await tsnet.startProxy('100.64.0.5', port: 5050);
|
|
|
|
// Connect your client to the proxy
|
|
yourClient.connect('127.0.0.1', port: localPort);
|
|
|
|
// Clean up
|
|
await tsnet.stopProxy();
|
|
await tsnet.stop();
|
|
```
|
|
|
|
## Platform support
|
|
|
|
| Platform | Status |
|
|
|----------|--------|
|
|
| iOS | Supported (arm64 device + simulator) |
|
|
| Android | Planned |
|
|
|
|
## Requirements
|
|
|
|
- iOS 14.0+
|
|
- Tailscale auth key (generate at [login.tailscale.com](https://login.tailscale.com/admin/settings/keys))
|
|
|
|
## Building from source
|
|
|
|
The pre-built xcframework is included in the package. To rebuild from Go source:
|
|
|
|
```bash
|
|
# Prerequisites: Go 1.23+, Xcode
|
|
./build_go.sh
|
|
```
|
|
|
|
## License
|
|
|
|
BSD-3-Clause. See [LICENSE](LICENSE).
|