platform: modularize api/gui, add docs-tests-web foundation, and refresh root config
This commit is contained in:
35
selective-vpn-api/app/transport_policy_conflicts.go
Normal file
35
selective-vpn-api/app/transport_policy_conflicts.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package app
|
||||
|
||||
import "strings"
|
||||
|
||||
func isTransportConflictBlock(conflict TransportConflictRecord) bool {
|
||||
return strings.EqualFold(strings.TrimSpace(conflict.Severity), "block")
|
||||
}
|
||||
|
||||
func isTransportConflictForceOverridable(conflict TransportConflictRecord) bool {
|
||||
if !isTransportConflictBlock(conflict) {
|
||||
return false
|
||||
}
|
||||
switch strings.ToLower(strings.TrimSpace(conflict.Type)) {
|
||||
case "owner_switch":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func splitTransportBlockingConflicts(conflicts []TransportConflictRecord) (overridable []TransportConflictRecord, hard []TransportConflictRecord) {
|
||||
overridable = make([]TransportConflictRecord, 0)
|
||||
hard = make([]TransportConflictRecord, 0)
|
||||
for _, conflict := range conflicts {
|
||||
if !isTransportConflictBlock(conflict) {
|
||||
continue
|
||||
}
|
||||
if isTransportConflictForceOverridable(conflict) {
|
||||
overridable = append(overridable, conflict)
|
||||
continue
|
||||
}
|
||||
hard = append(hard, conflict)
|
||||
}
|
||||
return overridable, hard
|
||||
}
|
||||
Reference in New Issue
Block a user