mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
hostinfo: add FreeBSD support.
Add specific handling for common appliances based on FreeBSD: - pfSense HostInfo: {"OS":"freebsd","OSVersion":"pfSense 2.5.2-RELEASE; version=12.2-STABLE" - OPNsense HostInfo: {"OS":"freebsd","OSVersion":"OPNsense 21.7.1 (amd64/OpenSSL); version=12.1-RELEASE-p19-HBSD" - TrueNAS HostInfo: {"OS":"freebsd","OSVersion":"TrueNAS-12.0-U5.1 (6c639bd48a); version=12.2-RELEASE-p9" - FreeNAS HostInfo: {"OS":"freebsd","OSVersion":"FreeNAS-11.3-U5 (2e4ded5a0a); version=11.3-RELEASE-p14", - regular FreeBSD HostInfo: {"OS":"freebsd","OSVersion":"FreeBSD; version=12.2-RELEASE" Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:

committed by
Denton Gentry

parent
5a58fd8933
commit
1d1efbb599
@@ -19,6 +19,9 @@ const (
|
||||
OpenWrt = Distro("openwrt")
|
||||
NixOS = Distro("nixos")
|
||||
QNAP = Distro("qnap")
|
||||
Pfsense = Distro("pfsense")
|
||||
OPNsense = Distro("opnsense")
|
||||
TrueNAS = Distro("truenas")
|
||||
)
|
||||
|
||||
// Get returns the current distro, or the empty string if unknown.
|
||||
@@ -26,6 +29,9 @@ func Get() Distro {
|
||||
if runtime.GOOS == "linux" {
|
||||
return linuxDistro()
|
||||
}
|
||||
if runtime.GOOS == "freebsd" {
|
||||
return freebsdDistro()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -56,3 +62,15 @@ func linuxDistro() Distro {
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func freebsdDistro() Distro {
|
||||
switch {
|
||||
case have("/etc/pfSense-rc"):
|
||||
return Pfsense
|
||||
case have("/usr/local/sbin/opnsense-shell"):
|
||||
return OPNsense
|
||||
case have("/usr/local/bin/freenas-debug"):
|
||||
return TrueNAS
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user