fix: typo
This commit is contained in:
parent
2012980d2b
commit
74390b9927
@ -44,7 +44,7 @@ func ClassifyNATFeature(addresses []string, localIPs []string) (*NatFeature, err
|
|||||||
if len(addresses) <= 1 {
|
if len(addresses) <= 1 {
|
||||||
return nil, fmt.Errorf("not enough addresses")
|
return nil, fmt.Errorf("not enough addresses")
|
||||||
}
|
}
|
||||||
natFeatrue := &NatFeature{}
|
natFeature := &NatFeature{}
|
||||||
ipChanged := false
|
ipChanged := false
|
||||||
portChanged := false
|
portChanged := false
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ func ClassifyNATFeature(addresses []string, localIPs []string) (*NatFeature, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if lo.Contains(localIPs, ip) {
|
if lo.Contains(localIPs, ip) {
|
||||||
natFeatrue.PublicNetwork = true
|
natFeature.PublicNetwork = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if baseIP == "" {
|
if baseIP == "" {
|
||||||
@ -85,26 +85,26 @@ func ClassifyNATFeature(addresses []string, localIPs []string) (*NatFeature, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
natFeatrue.PortsDifference = portMax - portMin
|
natFeature.PortsDifference = portMax - portMin
|
||||||
if natFeatrue.PortsDifference <= 10 && natFeatrue.PortsDifference >= 1 {
|
if natFeature.PortsDifference <= 10 && natFeature.PortsDifference >= 1 {
|
||||||
natFeatrue.RegularPortsChange = true
|
natFeature.RegularPortsChange = true
|
||||||
}
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case ipChanged && portChanged:
|
case ipChanged && portChanged:
|
||||||
natFeatrue.NatType = HardNAT
|
natFeature.NatType = HardNAT
|
||||||
natFeatrue.Behavior = BehaviorBothChanged
|
natFeature.Behavior = BehaviorBothChanged
|
||||||
case ipChanged:
|
case ipChanged:
|
||||||
natFeatrue.NatType = HardNAT
|
natFeature.NatType = HardNAT
|
||||||
natFeatrue.Behavior = BehaviorIPChanged
|
natFeature.Behavior = BehaviorIPChanged
|
||||||
case portChanged:
|
case portChanged:
|
||||||
natFeatrue.NatType = HardNAT
|
natFeature.NatType = HardNAT
|
||||||
natFeatrue.Behavior = BehaviorPortChanged
|
natFeature.Behavior = BehaviorPortChanged
|
||||||
default:
|
default:
|
||||||
natFeatrue.NatType = EasyNAT
|
natFeature.NatType = EasyNAT
|
||||||
natFeatrue.Behavior = BehaviorNoChange
|
natFeature.Behavior = BehaviorNoChange
|
||||||
}
|
}
|
||||||
return natFeatrue, nil
|
return natFeature, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ClassifyFeatureCount(features []*NatFeature) (int, int, int) {
|
func ClassifyFeatureCount(features []*NatFeature) (int, int, int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user