Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Conversation

@zamderax
Copy link
Member

No description provided.

zamderax and others added 14 commits July 29, 2025 10:54
- 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.
@zamderax zamderax merged commit 335dcc1 into main Jul 30, 2025
0 of 3 checks passed
@zamderax zamderax deleted the feat/cross-platform-swift branch July 30, 2025 02:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants