mirror of
https://github.com/tailscale/tailscale.git
synced 2026-12-03 13:56:36 +09:00
Enable the existing Android-safe interface fallback in cgo builds. Keep androidbin out of condregister for Android cgo applications, which provide their own interface getter; embedded consumers can opt in by importing androidbin directly. Updates #17311 Change-Id: Ia26706d9757525c1bc619935574797808b693034 Signed-off-by: Loz Brown <9961593+lozbrown@users.noreply.github.com>
21 lines
472 B
Go
21 lines
472 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build linux || android
|
|
|
|
package androidbin
|
|
|
|
import (
|
|
"tailscale.com/feature"
|
|
"tailscale.com/net/netmon"
|
|
)
|
|
|
|
// Android apps may register a Java-backed interface getter. This fallback
|
|
// is consulted only if no getter is registered and net.Interfaces fails.
|
|
func init() {
|
|
if !feature.Register("androidbin") {
|
|
return
|
|
}
|
|
netmon.HookInterfacesFallback.Set(fallbackInterfaces)
|
|
}
|