mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-20 21:36:00 +00:00
Skip Ipv6 check
This commit is contained in:
1 parent
d9f23f9b44
commit
3522a64955
3 files changed
+38
-63
No files matched your search
@@ -15,6 +15,7 @@ class IPv6DeviceScanner {
|
||||
/// - completion: Callback with a list of detected device IPs (excluding router).
|
||||
func scan(timeout: TimeInterval = 2.0, completion: @escaping ([String]) -> Void) {
|
||||
|
||||
|
||||
let interface = getActiveNetworkInterface() ?? "en0"
|
||||
|
||||
let process = Process()
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// NetworkConnectionCheck.swift
|
||||
// QuickDrop
|
||||
//
|
||||
// Created by Leon Böttger on 16.05.25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SystemConfiguration
|
||||
|
||||
/// Returns true if the device is connected to any network (Wi-Fi, Ethernet, etc.)
|
||||
func isConnectedToNetwork() -> Bool {
|
||||
var zeroAddress = sockaddr_in(
|
||||
sin_len: UInt8(MemoryLayout<sockaddr_in>.size),
|
||||
sin_family: sa_family_t(AF_INET),
|
||||
sin_port: 0,
|
||||
sin_addr: in_addr(s_addr: 0),
|
||||
sin_zero: (0,0,0,0,0,0,0,0)
|
||||
)
|
||||
|
||||
guard let defaultRouteReachability = withUnsafePointer(to: &zeroAddress, {
|
||||
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) { zeroSockAddress in
|
||||
SCNetworkReachabilityCreateWithAddress(nil, zeroSockAddress)
|
||||
}
|
||||
}) else {
|
||||
return false
|
||||
}
|
||||
|
||||
var flags = SCNetworkReachabilityFlags()
|
||||
if !SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) {
|
||||
return false
|
||||
}
|
||||
|
||||
let isReachable = flags.contains(.reachable)
|
||||
let needsConnection = flags.contains(.connectionRequired)
|
||||
|
||||
return isReachable && !needsConnection
|
||||
}
|
||||
Reference in new issue
Block a user