You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gpt-pilot/apps/shared/OpenClawKit/Sources/OpenClawKit/NetworkInterfaces.swift

18 lines
428 B
Swift

import Foundation
public enum NetworkInterfaces {
public static func primaryIPv4Address() -> String? {
var fallback: String?
var en0: String?
for entry in NetworkInterfaceIPv4.addresses() {
if entry.name == "en0" {
en0 = entry.ip
break
}
if fallback == nil { fallback = entry.ip }
}
return en0 ?? fallback
}
}