mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-21 14:23:34 +00:00
Initial
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
49
vendor/github.com/Microsoft/hcsshim/internal/hns/hnssupport.go
generated
vendored
Normal file
49
vendor/github.com/Microsoft/hcsshim/internal/hns/hnssupport.go
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
package hns
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type HNSSupportedFeatures struct {
|
||||
Acl HNSAclFeatures `json:"ACL"`
|
||||
}
|
||||
|
||||
type HNSAclFeatures struct {
|
||||
AclAddressLists bool `json:"AclAddressLists"`
|
||||
AclNoHostRulePriority bool `json:"AclHostRulePriority"`
|
||||
AclPortRanges bool `json:"AclPortRanges"`
|
||||
AclRuleId bool `json:"AclRuleId"`
|
||||
}
|
||||
|
||||
func GetHNSSupportedFeatures() HNSSupportedFeatures {
|
||||
var hnsFeatures HNSSupportedFeatures
|
||||
|
||||
globals, err := GetHNSGlobals()
|
||||
if err != nil {
|
||||
// Expected on pre-1803 builds, all features will be false/unsupported
|
||||
logrus.Debugf("Unable to obtain HNS globals: %s", err)
|
||||
return hnsFeatures
|
||||
}
|
||||
|
||||
hnsFeatures.Acl = HNSAclFeatures{
|
||||
AclAddressLists: isHNSFeatureSupported(globals.Version, HNSVersion1803),
|
||||
AclNoHostRulePriority: isHNSFeatureSupported(globals.Version, HNSVersion1803),
|
||||
AclPortRanges: isHNSFeatureSupported(globals.Version, HNSVersion1803),
|
||||
AclRuleId: isHNSFeatureSupported(globals.Version, HNSVersion1803),
|
||||
}
|
||||
|
||||
return hnsFeatures
|
||||
}
|
||||
|
||||
func isHNSFeatureSupported(currentVersion HNSVersion, minVersionSupported HNSVersion) bool {
|
||||
if currentVersion.Major < minVersionSupported.Major {
|
||||
return false
|
||||
}
|
||||
if currentVersion.Major > minVersionSupported.Major {
|
||||
return true
|
||||
}
|
||||
if currentVersion.Minor < minVersionSupported.Minor {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
Reference in New Issue
Block a user