mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-16 22:40:54 +02:00
* cscli: extrack package 'crowdsec-cli/ask' * cscli: extract package 'crowdsec-cli/clientinfo'
39 lines
553 B
Go
39 lines
553 B
Go
package clientinfo
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
type featureflagProvider interface {
|
|
GetFeatureflags() string
|
|
}
|
|
|
|
type osProvider interface {
|
|
GetOsname() string
|
|
GetOsversion() string
|
|
}
|
|
|
|
func GetOSNameAndVersion(o osProvider) string {
|
|
ret := o.GetOsname()
|
|
if o.GetOsversion() != "" {
|
|
if ret != "" {
|
|
ret += "/"
|
|
}
|
|
|
|
ret += o.GetOsversion()
|
|
}
|
|
|
|
if ret == "" {
|
|
return "?"
|
|
}
|
|
|
|
return ret
|
|
}
|
|
|
|
func GetFeatureFlagList(o featureflagProvider) []string {
|
|
if o.GetFeatureflags() == "" {
|
|
return nil
|
|
}
|
|
|
|
return strings.Split(o.GetFeatureflags(), ",")
|
|
}
|