fix(monitors): 补齐联网权限并释放采样端口引用

This commit is contained in:
2026-11-03 21:59:49 +08:00
parent cecd646376
commit ea4d0e7f23
7 changed files with 89 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
import Foundation
import Darwin
/// Run only inside a temporary signed app with the built host's entitlements.
/// This opt-in integration check contacts the same HTTPS endpoint as the app.
@main struct SandboxNetworkChecks {
static func main() async {
var request = URLRequest(url: URL(string: "https://api.ipify.org")!)
request.timeoutInterval = 5
do {
let (_, response) = try await URLSession.shared.data(for: request)
guard (response as? HTTPURLResponse)?.statusCode == 200 else {
print("FAIL: public-address endpoint did not return HTTP 200")
exit(1)
}
print("PASS: signed sandbox public-address HTTPS request returned HTTP 200")
} catch {
// Keep the public address and potentially identifying error URLs out of logs.
let error = error as NSError
print("FAIL: sandbox HTTPS request: \(error.domain) code \(error.code)")
exit(1)
}
}
}