diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..304f88e --- /dev/null +++ b/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2026, Svrnty + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ios/Classes/TailscaleKitPlugin.swift b/ios/Classes/TsnetFlutterPlugin.swift similarity index 97% rename from ios/Classes/TailscaleKitPlugin.swift rename to ios/Classes/TsnetFlutterPlugin.swift index 6c90837..a9b5861 100644 --- a/ios/Classes/TailscaleKitPlugin.swift +++ b/ios/Classes/TsnetFlutterPlugin.swift @@ -11,7 +11,7 @@ import UIKit /// TailscaleStatus(&err) → JSON string or NULL /// TailscaleIP(&err) → IP string or NULL /// TailscaleFreeString(ptr) → frees returned strings -public class TailscaleKitPlugin: NSObject, FlutterPlugin { +public class TsnetFlutterPlugin: NSObject, FlutterPlugin { private lazy var stateDir: String = { let docs = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! @@ -21,8 +21,8 @@ public class TailscaleKitPlugin: NSObject, FlutterPlugin { }() public static func register(with registrar: FlutterPluginRegistrar) { - let channel = FlutterMethodChannel(name: "tailscale_kit", binaryMessenger: registrar.messenger()) - let instance = TailscaleKitPlugin() + let channel = FlutterMethodChannel(name: "tsnet_flutter", binaryMessenger: registrar.messenger()) + let instance = TsnetFlutterPlugin() registrar.addMethodCallDelegate(instance, channel: channel) } diff --git a/ios/tailscale_kit.podspec b/ios/tsnet_flutter.podspec similarity index 72% rename from ios/tailscale_kit.podspec rename to ios/tsnet_flutter.podspec index 9cb282d..11c4764 100644 --- a/ios/tailscale_kit.podspec +++ b/ios/tsnet_flutter.podspec @@ -1,15 +1,15 @@ Pod::Spec.new do |s| - s.name = 'tailscale_kit' + s.name = 'tsnet_flutter' s.version = '0.1.0' s.summary = 'Embedded Tailscale tsnet for Flutter' s.description = <<-DESC -Provides a WireGuard tunnel to Constellation heaters via embedded tsnet. -Built with go build -buildmode=c-archive (production Go approach). +Embed Tailscale's tsnet in Flutter apps. Provides a userspace WireGuard +tunnel with a localhost TCP proxy. Built with go build -buildmode=c-archive. No VPN entitlement needed — uses userspace netstack. DESC - s.homepage = 'https://github.com/constellation-heating/tailscale-kit' - s.license = { :type => 'MIT' } - s.author = { 'Constellation Heating' => 'dev@constellation-heating.com' } + s.homepage = 'https://github.com/svrnty/tsnet_flutter' + s.license = { :type => 'BSD-3-Clause', :file => '../LICENSE' } + s.author = { 'Svrnty' => 'mathias@svrnty.io' } s.source = { :path => '.' } s.source_files = 'Classes/**/*.{swift,h}' s.public_header_files = 'Classes/**/*.h' @@ -23,7 +23,6 @@ No VPN entitlement needed — uses userspace netstack. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 x86_64', - # Force-link the Go static library into this pod's dynamic framework 'OTHER_LDFLAGS' => '$(inherited) -force_load "$(PODS_TARGET_SRCROOT)/_current_slice/TailscaleKit.framework/TailscaleKit"', } @@ -31,7 +30,6 @@ No VPN entitlement needed — uses userspace netstack. 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 x86_64', } - # Before compile: symlink the correct xcframework slice for the current platform s.script_phase = { :name => 'Select TailscaleKit Slice', :script => <<-'SCRIPT', diff --git a/lib/tailscale_kit.dart b/lib/tsnet_flutter.dart similarity index 90% rename from lib/tailscale_kit.dart rename to lib/tsnet_flutter.dart index 92c6b65..ef243ab 100644 --- a/lib/tailscale_kit.dart +++ b/lib/tsnet_flutter.dart @@ -4,20 +4,20 @@ import 'package:flutter/services.dart'; /// Embedded Tailscale tsnet client for Flutter. /// -/// Provides a WireGuard tunnel to Constellation heaters via Tailscale, -/// without requiring the user to install the Tailscale app. +/// Provides a userspace WireGuard tunnel via Tailscale's tsnet library, +/// without requiring the user to install the Tailscale app or a VPN entitlement. /// -/// Architecture: Go xcframework (tsnet) ↔ Swift bridge ↔ MethodChannel ↔ Dart +/// Architecture: Go static library (tsnet) ↔ Swift C bridge ↔ MethodChannel ↔ Dart /// /// Usage: /// ```dart -/// final ts = TailscaleKit(); +/// final ts = TsnetFlutter(); /// await ts.start(authKey: 'tskey-auth-...'); /// final port = await ts.startProxy('100.64.0.5'); -/// grpcService.connect('127.0.0.1', port: port); +/// // Connect your client to localhost:port — traffic tunnels via WireGuard /// ``` -class TailscaleKit { - static const _channel = MethodChannel('tailscale_kit'); +class TsnetFlutter { + static const _channel = MethodChannel('tsnet_flutter'); /// Join the Tailnet with the given auth key. /// diff --git a/pubspec.yaml b/pubspec.yaml index 66f9702..2898f04 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,9 @@ -name: tailscale_kit -description: Embedded Tailscale tsnet for Flutter — provides WireGuard tunnel to Constellation heaters without requiring the Tailscale app. +name: tsnet_flutter +description: Embed Tailscale's tsnet in Flutter apps. Provides a userspace WireGuard tunnel with a localhost TCP proxy — no VPN entitlement needed on iOS. version: 0.1.0 -publish_to: 'none' +homepage: https://github.com/svrnty/tsnet_flutter +repository: https://github.com/svrnty/tsnet_flutter +issue_tracker: https://github.com/svrnty/tsnet_flutter/issues environment: sdk: ^3.10.1 @@ -20,4 +22,4 @@ flutter: plugin: platforms: ios: - pluginClass: TailscaleKitPlugin + pluginClass: TsnetFlutterPlugin