mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 05:46:03 +00:00
Add network connection check
This commit is contained in:
1 parent
6f1c4f4cf9
commit
d9f23f9b44
10 files changed
+111
-331
No files matched your search
@@ -11,10 +11,12 @@ import Network
|
||||
class IPv6DeviceScanner {
|
||||
/// Scans for IPv6 devices using `ping6 ff02::1` multicast on the given interface.
|
||||
/// - Parameters:
|
||||
/// - interface: The interface to scan on (e.g. "en0").
|
||||
/// - timeout: How long to wait for replies (default 2 seconds).
|
||||
/// - completion: Callback with a list of detected device IPs (excluding router).
|
||||
func scan(interface: String = "en0", timeout: TimeInterval = 2.0, completion: @escaping ([String]) -> Void) {
|
||||
func scan(timeout: TimeInterval = 2.0, completion: @escaping ([String]) -> Void) {
|
||||
|
||||
let interface = getActiveNetworkInterface() ?? "en0"
|
||||
|
||||
let process = Process()
|
||||
process.executableURL = URL(fileURLWithPath: "/sbin/ping6")
|
||||
process.arguments = ["-I", interface, "-c", "2", "ff02::1"]
|
||||
|
||||
Reference in new issue
Block a user