Add ios stub

This commit is contained in:
Owen
2026-07-06 16:56:37 -04:00
parent 7a88fac395
commit f356aed39b
2 changed files with 32 additions and 9 deletions

18
dns/sysresolver_ios.go Normal file
View File

@@ -0,0 +1,18 @@
//go:build ios
package dns
// readSystemDNS returns nil on iOS: olm cannot read the OS's DNS
// configuration itself here, so the app must detect it and push it in
// through the equivalent of Olm.SetSystemDNS instead.
//
// This is a dedicated file (rather than falling through the general
// sysresolver_stub.go catch-all) because Go's build constraint evaluator
// treats GOOS=ios as implicitly satisfying the "darwin" tag as well as
// "ios". sysresolver_stub.go excludes with "!darwin", which is false for an
// iOS build, so the stub silently stops applying and would leave
// readSystemDNS undefined. An explicit "ios" constraint isn't affected by
// that ambiguity.
func readSystemDNS() []string {
return nil
}

View File

@@ -3,16 +3,21 @@
package dns
// readSystemDNS returns nil on platforms where automatic DNS discovery is not
// implemented (ios, freebsd, etc.). Callers should fall back to a
// statically configured DNS server.
// implemented (freebsd, etc.). Callers should fall back to a statically
// configured DNS server.
//
// android is excluded from this constraint (and has its own sysresolver_android.go
// with an explicit "android" tag) rather than falling through the "!linux" catch-all
// here: wireguard-android's build passes "-tags linux" to share Linux netlink code
// (a deliberate, long-standing convention, since Android's kernel is Linux), and Go's
// build constraint evaluator can't distinguish a custom "-tags linux" from the real
// GOOS=linux - so with that tag set, "!linux" is false even though GOOS is actually
// android, and this file would silently stop applying, leaving readSystemDNS undefined.
// android and ios are excluded from this constraint (and have their own
// sysresolver_android.go / sysresolver_ios.go with an explicit "android" /
// "ios" tag) rather than falling through the "!linux" / "!darwin" catch-all
// here:
// - wireguard-android's build passes "-tags linux" to share Linux netlink code
// (a deliberate, long-standing convention, since Android's kernel is Linux), and Go's
// build constraint evaluator can't distinguish a custom "-tags linux" from the real
// GOOS=linux - so with that tag set, "!linux" is false even though GOOS is actually
// android, and this file would silently stop applying, leaving readSystemDNS undefined.
// - Go's build constraint evaluator treats GOOS=ios as implicitly satisfying the
// "darwin" tag as well as "ios", so "!darwin" is false on an iOS build too, which
// would otherwise leave readSystemDNS undefined there as well.
func readSystemDNS() []string {
return nil
}