go.mod github.com/Microsoft/hcsshim v0.8.16
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
53
vendor/github.com/Microsoft/hcsshim/hcn/hcnsupport.go
generated
vendored
53
vendor/github.com/Microsoft/hcsshim/hcn/hcnsupport.go
generated
vendored
@ -6,11 +6,19 @@ import (
|
||||
|
||||
// SupportedFeatures are the features provided by the Service.
|
||||
type SupportedFeatures struct {
|
||||
Acl AclFeatures `json:"ACL"`
|
||||
Api ApiSupport `json:"API"`
|
||||
RemoteSubnet bool `json:"RemoteSubnet"`
|
||||
HostRoute bool `json:"HostRoute"`
|
||||
DSR bool `json:"DSR"`
|
||||
Acl AclFeatures `json:"ACL"`
|
||||
Api ApiSupport `json:"API"`
|
||||
RemoteSubnet bool `json:"RemoteSubnet"`
|
||||
HostRoute bool `json:"HostRoute"`
|
||||
DSR bool `json:"DSR"`
|
||||
Slash32EndpointPrefixes bool `json:"Slash32EndpointPrefixes"`
|
||||
AclSupportForProtocol252 bool `json:"AclSupportForProtocol252"`
|
||||
SessionAffinity bool `json:"SessionAffinity"`
|
||||
IPv6DualStack bool `json:"IPv6DualStack"`
|
||||
SetPolicy bool `json:"SetPolicy"`
|
||||
VxlanPort bool `json:"VxlanPort"`
|
||||
L4Proxy bool `json:"L4Proxy"` // network policy that applies VFP rules to all endpoints on the network to redirect traffic
|
||||
L4WfpProxy bool `json:"L4WfpProxy"` // endpoint policy that applies WFP filters to redirect traffic to/from that endpoint
|
||||
}
|
||||
|
||||
// AclFeatures are the supported ACL possibilities.
|
||||
@ -53,18 +61,43 @@ func GetSupportedFeatures() SupportedFeatures {
|
||||
features.RemoteSubnet = isFeatureSupported(globals.Version, RemoteSubnetVersion)
|
||||
features.HostRoute = isFeatureSupported(globals.Version, HostRouteVersion)
|
||||
features.DSR = isFeatureSupported(globals.Version, DSRVersion)
|
||||
features.Slash32EndpointPrefixes = isFeatureSupported(globals.Version, Slash32EndpointPrefixesVersion)
|
||||
features.AclSupportForProtocol252 = isFeatureSupported(globals.Version, AclSupportForProtocol252Version)
|
||||
features.SessionAffinity = isFeatureSupported(globals.Version, SessionAffinityVersion)
|
||||
features.IPv6DualStack = isFeatureSupported(globals.Version, IPv6DualStackVersion)
|
||||
features.SetPolicy = isFeatureSupported(globals.Version, SetPolicyVersion)
|
||||
features.VxlanPort = isFeatureSupported(globals.Version, VxlanPortVersion)
|
||||
features.L4Proxy = isFeatureSupported(globals.Version, L4ProxyPolicyVersion)
|
||||
features.L4WfpProxy = isFeatureSupported(globals.Version, L4WfpProxyPolicyVersion)
|
||||
|
||||
return features
|
||||
}
|
||||
|
||||
func isFeatureSupported(currentVersion Version, minVersionSupported Version) bool {
|
||||
if currentVersion.Major < minVersionSupported.Major {
|
||||
func isFeatureSupported(currentVersion Version, versionsSupported VersionRanges) bool {
|
||||
isFeatureSupported := false
|
||||
|
||||
for _, versionRange := range versionsSupported {
|
||||
isFeatureSupported = isFeatureSupported || isFeatureInRange(currentVersion, versionRange)
|
||||
}
|
||||
|
||||
return isFeatureSupported
|
||||
}
|
||||
|
||||
func isFeatureInRange(currentVersion Version, versionRange VersionRange) bool {
|
||||
if currentVersion.Major < versionRange.MinVersion.Major {
|
||||
logrus.Infof("currentVersion.Major < versionRange.MinVersion.Major: %v, %v", currentVersion.Major, versionRange.MinVersion.Major)
|
||||
return false
|
||||
}
|
||||
if currentVersion.Major > minVersionSupported.Major {
|
||||
return true
|
||||
if currentVersion.Major > versionRange.MaxVersion.Major {
|
||||
logrus.Infof("currentVersion.Major > versionRange.MaxVersion.Major: %v, %v", currentVersion.Major, versionRange.MaxVersion.Major)
|
||||
return false
|
||||
}
|
||||
if currentVersion.Minor < minVersionSupported.Minor {
|
||||
if currentVersion.Major == versionRange.MinVersion.Major && currentVersion.Minor < versionRange.MinVersion.Minor {
|
||||
logrus.Infof("currentVersion.Minor < versionRange.MinVersion.Major: %v, %v", currentVersion.Minor, versionRange.MinVersion.Minor)
|
||||
return false
|
||||
}
|
||||
if currentVersion.Major == versionRange.MaxVersion.Major && currentVersion.Minor > versionRange.MaxVersion.Minor {
|
||||
logrus.Infof("currentVersion.Minor > versionRange.MaxVersion.Major: %v, %v", currentVersion.Minor, versionRange.MaxVersion.Minor)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
Reference in New Issue
Block a user