Add per-app setting annotations

This commit is contained in:
Daniel
2023-09-26 12:51:25 +02:00
parent a3457637e8
commit 9d6c7b400b

View File

@@ -194,9 +194,10 @@ func registerConfiguration() error { //nolint:maintidx
OptType: config.OptTypeString, OptType: config.OptTypeString,
DefaultValue: DefaultActionPermitValue, DefaultValue: DefaultActionPermitValue,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: config.DisplayHintOneOf, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionDefaultActionOrder, config.DisplayHintAnnotation: config.DisplayHintOneOf,
config.CategoryAnnotation: "General", config.DisplayOrderAnnotation: cfgOptionDefaultActionOrder,
config.CategoryAnnotation: "General",
}, },
PossibleValues: []config.PossibleValue{ PossibleValues: []config.PossibleValue{
{ {
@@ -232,9 +233,10 @@ func registerConfiguration() error { //nolint:maintidx
ReleaseLevel: config.ReleaseLevelBeta, ReleaseLevel: config.ReleaseLevelBeta,
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayOrderAnnotation: cfgOptionDisableAutoPermitOrder, config.SettablePerAppAnnotation: true,
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.DisplayOrderAnnotation: cfgOptionDisableAutoPermitOrder,
config.CategoryAnnotation: "Advanced", config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Advanced",
}, },
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
}) })
@@ -256,6 +258,7 @@ In order to reduce noise optimize performance, internal and device-only (localho
ExpertiseLevel: config.ExpertiseLevelUser, ExpertiseLevel: config.ExpertiseLevelUser,
DefaultValue: false, DefaultValue: false,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionEnableHistoryOrder, config.DisplayOrderAnnotation: cfgOptionEnableHistoryOrder,
config.CategoryAnnotation: "General", config.CategoryAnnotation: "General",
config.RequiresFeatureIDAnnotation: account.FeatureHistory, config.RequiresFeatureIDAnnotation: account.FeatureHistory,
@@ -280,6 +283,7 @@ Set to 0 days to keep network history forever. Depending on your device, this mi
ExpertiseLevel: config.ExpertiseLevelUser, ExpertiseLevel: config.ExpertiseLevelUser,
DefaultValue: 30, DefaultValue: 30,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.UnitAnnotation: "Days", config.UnitAnnotation: "Days",
config.DisplayOrderAnnotation: cfgOptionKeepHistoryOrder, config.DisplayOrderAnnotation: cfgOptionKeepHistoryOrder,
config.CategoryAnnotation: "General", config.CategoryAnnotation: "General",
@@ -344,6 +348,7 @@ Pro Tip: You can use "#" to add a comment to a rule.
OptType: config.OptTypeStringArray, OptType: config.OptTypeStringArray,
DefaultValue: []string{}, DefaultValue: []string{},
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.StackableAnnotation: true, config.StackableAnnotation: true,
config.DisplayHintAnnotation: endpoints.DisplayHintEndpointList, config.DisplayHintAnnotation: endpoints.DisplayHintEndpointList,
config.DisplayOrderAnnotation: cfgOptionEndpointsOrder, config.DisplayOrderAnnotation: cfgOptionEndpointsOrder,
@@ -370,6 +375,7 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: []string{}, DefaultValue: []string{},
ExpertiseLevel: config.ExpertiseLevelExpert, ExpertiseLevel: config.ExpertiseLevelExpert,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.StackableAnnotation: true, config.StackableAnnotation: true,
config.DisplayHintAnnotation: endpoints.DisplayHintEndpointList, config.DisplayHintAnnotation: endpoints.DisplayHintEndpointList,
config.DisplayOrderAnnotation: cfgOptionServiceEndpointsOrder, config.DisplayOrderAnnotation: cfgOptionServiceEndpointsOrder,
@@ -426,9 +432,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
OptType: config.OptTypeStringArray, OptType: config.OptTypeStringArray,
DefaultValue: defaultFilterListsValue, DefaultValue: defaultFilterListsValue,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: "filter list", config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionFilterListsOrder, config.DisplayHintAnnotation: "filter list",
config.CategoryAnnotation: "Filter Lists", config.DisplayOrderAnnotation: cfgOptionFilterListsOrder,
config.CategoryAnnotation: "Filter Lists",
}, },
ValidationRegex: `^[a-zA-Z0-9\-]+$`, ValidationRegex: `^[a-zA-Z0-9\-]+$`,
}) })
@@ -447,9 +454,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
ExpertiseLevel: config.ExpertiseLevelExpert, ExpertiseLevel: config.ExpertiseLevelExpert,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionFilterCNAMEOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "DNS Filtering", config.DisplayOrderAnnotation: cfgOptionFilterCNAMEOrder,
config.CategoryAnnotation: "DNS Filtering",
}, },
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
}) })
@@ -468,9 +476,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionFilterSubDomainsOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Filter Lists", config.DisplayOrderAnnotation: cfgOptionFilterSubDomainsOrder,
config.CategoryAnnotation: "Filter Lists",
}, },
}) })
if err != nil { if err != nil {
@@ -489,9 +498,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelOff, DefaultValue: status.SecurityLevelOff,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionBlockScopeLocalOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Network Scope", config.DisplayOrderAnnotation: cfgOptionBlockScopeLocalOrder,
config.CategoryAnnotation: "Network Scope",
}, },
}) })
if err != nil { if err != nil {
@@ -509,9 +519,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelOff, DefaultValue: status.SecurityLevelOff,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionBlockScopeLANOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Network Scope", config.DisplayOrderAnnotation: cfgOptionBlockScopeLANOrder,
config.CategoryAnnotation: "Network Scope",
}, },
}) })
if err != nil { if err != nil {
@@ -529,9 +540,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelOff, DefaultValue: status.SecurityLevelOff,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionBlockScopeInternetOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Network Scope", config.DisplayOrderAnnotation: cfgOptionBlockScopeInternetOrder,
config.CategoryAnnotation: "Network Scope",
}, },
}) })
if err != nil { if err != nil {
@@ -549,9 +561,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelOff, DefaultValue: status.SecurityLevelOff,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionBlockP2POrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Connection Types", config.DisplayOrderAnnotation: cfgOptionBlockP2POrder,
config.CategoryAnnotation: "Connection Types",
}, },
}) })
if err != nil { if err != nil {
@@ -569,9 +582,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionBlockInboundOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Connection Types", config.DisplayOrderAnnotation: cfgOptionBlockInboundOrder,
config.CategoryAnnotation: "Connection Types",
}, },
}) })
if err != nil { if err != nil {
@@ -590,9 +604,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionRemoveOutOfScopeDNSOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "DNS Filtering", config.DisplayOrderAnnotation: cfgOptionRemoveOutOfScopeDNSOrder,
config.CategoryAnnotation: "DNS Filtering",
}, },
}) })
if err != nil { if err != nil {
@@ -611,9 +626,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionRemoveBlockedDNSOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "DNS Filtering", config.DisplayOrderAnnotation: cfgOptionRemoveBlockedDNSOrder,
config.CategoryAnnotation: "DNS Filtering",
}, },
}) })
if err != nil { if err != nil {
@@ -632,9 +648,10 @@ Pro Tip: You can use "#" to add a comment to a rule.
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionDomainHeuristicsOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "DNS Filtering", config.DisplayOrderAnnotation: cfgOptionDomainHeuristicsOrder,
config.CategoryAnnotation: "DNS Filtering",
}, },
}) })
if err != nil { if err != nil {
@@ -662,9 +679,10 @@ Please note that DNS bypass attempts might be additionally blocked in the Sytem
DefaultValue: status.SecurityLevelsAll, DefaultValue: status.SecurityLevelsAll,
PossibleValues: status.AllSecurityLevelValues, PossibleValues: status.AllSecurityLevelValues,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionPreventBypassingOrder, config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Advanced", config.DisplayOrderAnnotation: cfgOptionPreventBypassingOrder,
config.CategoryAnnotation: "Advanced",
}, },
}) })
if err != nil { if err != nil {
@@ -681,8 +699,9 @@ Please note that DNS bypass attempts might be additionally blocked in the Sytem
OptType: config.OptTypeBool, OptType: config.OptTypeBool,
DefaultValue: true, DefaultValue: true,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayOrderAnnotation: cfgOptionUseSPNOrder, config.SettablePerAppAnnotation: true,
config.CategoryAnnotation: "General", config.DisplayOrderAnnotation: cfgOptionUseSPNOrder,
config.CategoryAnnotation: "General",
}, },
}) })
if err != nil { if err != nil {
@@ -701,6 +720,7 @@ Please note that DNS bypass attempts might be additionally blocked in the Sytem
OptType: config.OptTypeStringArray, OptType: config.OptTypeStringArray,
DefaultValue: []string{}, DefaultValue: []string{},
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.StackableAnnotation: true, config.StackableAnnotation: true,
config.CategoryAnnotation: "General", config.CategoryAnnotation: "General",
config.DisplayOrderAnnotation: cfgOptionSPNUsagePolicyOrder, config.DisplayOrderAnnotation: cfgOptionSPNUsagePolicyOrder,
@@ -727,6 +747,7 @@ Please note that DNS bypass attempts might be additionally blocked in the Sytem
ExpertiseLevel: config.ExpertiseLevelExpert, ExpertiseLevel: config.ExpertiseLevelExpert,
DefaultValue: []string{}, DefaultValue: []string{},
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.StackableAnnotation: true, config.StackableAnnotation: true,
config.CategoryAnnotation: "Routing", config.CategoryAnnotation: "Routing",
config.DisplayOrderAnnotation: cfgOptionTransitHubPolicyOrder, config.DisplayOrderAnnotation: cfgOptionTransitHubPolicyOrder,
@@ -755,6 +776,7 @@ By default, the Portmaster tries to choose the node closest to the destination a
OptType: config.OptTypeStringArray, OptType: config.OptTypeStringArray,
DefaultValue: []string{}, DefaultValue: []string{},
Annotations: config.Annotations{ Annotations: config.Annotations{
config.SettablePerAppAnnotation: true,
config.StackableAnnotation: true, config.StackableAnnotation: true,
config.CategoryAnnotation: "Routing", config.CategoryAnnotation: "Routing",
config.DisplayOrderAnnotation: cfgOptionExitHubPolicyOrder, config.DisplayOrderAnnotation: cfgOptionExitHubPolicyOrder,
@@ -779,9 +801,10 @@ By default, the Portmaster tries to choose the node closest to the destination a
OptType: config.OptTypeString, OptType: config.OptTypeString,
DefaultValue: DefaultRoutingProfileID, DefaultValue: DefaultRoutingProfileID,
Annotations: config.Annotations{ Annotations: config.Annotations{
config.DisplayHintAnnotation: config.DisplayHintOneOf, config.SettablePerAppAnnotation: true,
config.DisplayOrderAnnotation: cfgOptionRoutingAlgorithmOrder, config.DisplayHintAnnotation: config.DisplayHintOneOf,
config.CategoryAnnotation: "Routing", config.DisplayOrderAnnotation: cfgOptionRoutingAlgorithmOrder,
config.CategoryAnnotation: "Routing",
}, },
PossibleValues: []config.PossibleValue{ PossibleValues: []config.PossibleValue{
{ {