This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/cross platform swift #9
Merged
Merged
Conversation
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
- Add NetworkMonitor API based on RFC 9622/9623 Transport Services - Implement platform-specific backends: - Apple: Uses Network.framework and getifaddrs - Linux: Uses rtnetlink for interface monitoring - Windows: Uses IP Helper API - Android: Uses ConnectivityManager via JNI - Add Interface and ChangeEvent types for network state tracking - Support listing interfaces and monitoring changes - Add integration module for Transport Services connections - Include example demonstrating path monitoring usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix objc imports and macro usage - Remove unused imports - Add Send trait implementation for MonitorStopHandle - Fix string ownership issue in apple.rs - Change PlatformHandle type to avoid dyn Drop warning 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add NWPath-based detection of expensive (metered) connections - Implement interface index detection using if_nametoindex - Parse NWPath to check isExpensive and isConstrained properties - Improve interface type detection with more specific cases - Add detailed example showing expensive interface information This addresses the TODO for detecting expensive interfaces using the Network.framework's NWPath API. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated Apple platform implementation to use direct FFI bindings for Network.framework instead of Objective-C runtime. - Enhanced interface enumeration and path monitoring logic for Apple, including improved handling of expensive interfaces. - Streamlined Linux platform implementation using rtnetlink, ensuring consistent interface and address monitoring. - Improved Windows platform implementation with better error handling and code organization. - Added a new example demonstrating real-time network path monitoring. - Introduced a new module for direct FFI bindings to Network.framework, replacing previous Objective-C dependencies. - Cleaned up code formatting and removed unnecessary comments across all platform implementations.
… FFI - Use direct FFI bindings for Network.framework instead of objc2 (not supported) - Implement proper Objective-C block support for real-time callbacks - Fix Linux implementation to work with rtnetlink 0.14 - Add cross-platform compilation support and Docker test script - Fix all compiler warnings in tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add C-compatible structures for Interface, Status, and ChangeEvent - Implement FFI functions for creating monitors, listing interfaces, and watching changes - Add example C code demonstrating path monitor usage - Remove redundant run-linux-tests.sh (functionality covered by Dockerfile.build) The FFI bindings expose: - transport_services_path_monitor_create/destroy - transport_services_path_monitor_list_interfaces - transport_services_path_monitor_start/stop_watching - Callback mechanism for network change events 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ency - Implement PathMonitor wrapper with full async/await support - Add AsyncSequence implementation for network change events - Ensure thread safety with Sendable conformance and actor-based design - Create comprehensive example showing both CLI and SwiftUI usage - Support all Apple platforms (macOS, iOS, tvOS, watchOS, visionOS) The Swift bindings provide: - Type-safe interfaces with Swift enums and structs - Structured concurrency with TaskGroup support - Memory-safe FFI interactions with proper cleanup - Convenient helper properties (hasIPv4, isWiFi, etc.) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix ConnectionEvent field names from 'message'/'context' to 'message_data'/'message_context' - Add ListenerEvent to lib.rs exports - Fix pointer cast error in path_monitor.rs by using separate reference variable - Fix MessageContext field access errors (expiry, priority, idempotent don't exist on MessageContext) - Fix pointer type mismatch in path_monitor list_interfaces All FFI features now compile successfully.
…ation - Replace simple 'import Foundation' with conditional imports - Check for embedded platforms first (#if \!hasFeature(Embedded)) - Prefer FoundationEssentials when available for smaller binary size - Fall back to Foundation if FoundationEssentials is not available - Updated all Swift source files, examples, and tests This change reduces compilation size on Linux by using the lighter FoundationEssentials when available, and avoids importing Foundation entirely on embedded platforms.
Since platform requirements are already specified in Package.swift: - .macOS(.v15) - .iOS(.v18) - .tvOS(.v18) - .watchOS(.v11) - .visionOS(.v2) Removed @available attributes from: - Properties.swift: Preference, MultipathConfig, CommunicationDirection, TransportProperties, SecurityParameters - Endpoints.swift: Endpoint protocol, LocalEndpoint, RemoteEndpoint, Array extension, freeFFIEndpoints function
- Removed print statement from library code - Added overloaded acceptLoop with errorHandler parameter - Allows library users to control error handling - Prevents unwanted console output in production Library code should not print to stdout. Users can now: 1. Use the simple version and handle errors in their handler 2. Use the overloaded version with a custom error handler
- Added visionOS device target (aarch64-apple-visionos) - Added Apple Silicon simulator targets for all platforms: - iOS simulator (aarch64-apple-ios-sim) - tvOS simulator (aarch64-apple-tvos-sim) - watchOS simulator (aarch64-apple-watchos-sim) - visionOS simulator (aarch64-apple-visionos-sim) - Removed Intel Mac support (x86_64-apple-darwin) - Updated bundle groups to include all new targets - Updated header comment to reflect supported platforms Now supports Apple Silicon only for Mac, with full simulator support for development and testing.
- Updated `build-artifact-bundle.sh` to improve platform support and cross-compilation handling. - Removed `build-multi-platform.ps1` as it is no longer needed. - Added `install-cross-tools.sh` for installing cross-compilation tools on macOS. - Deleted `test-artifact-bundle-docker.sh` as it is redundant. - Enhanced the Windows path monitoring implementation to use `NotifyUnicastIpAddressChange` for better interface change detection. - Improved error handling and interface comparison logic in the Windows implementation. - Removed `test-linux-build.sh` as it is no longer relevant.
- Deleted Swift example files including workspace state, Package.swift, PathMonitorExample.swift, and TransportServicesExample.swift. - Updated the build-artifact-bundle.sh script to allow for selective platform builds and improved Android build configuration. - Refactored Android path monitoring implementation to use a more efficient state management approach with watchers. - Enhanced FFI module to include Android-specific functions and context management. - Modified ChangeEvent enum to derive Clone for better usability in event handling.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.