Skip to content

Commit

Permalink
Add quick setting support
Browse files Browse the repository at this point in the history
  • Loading branch information
ppacher committed Oct 27, 2020
1 parent 997787e commit 9ea2162
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 8 deletions.
4 changes: 4 additions & 0 deletions firewall/config.go
Expand Up @@ -55,6 +55,10 @@ func registerConfig() error {
Annotations: config.Annotations{
config.DisplayOrderAnnotation: cfgOptionAskWithSystemNotificationsOrder,
config.CategoryAnnotation: "General",
config.RequiresAnnotation: config.ValueRequirement{
Key: core.CfgUseSystemNotificationsKey,
Value: true,
},
},
})
if err != nil {
Expand Down
33 changes: 25 additions & 8 deletions profile/config.go
Expand Up @@ -139,7 +139,7 @@ func registerConfiguration() error {
Annotations: config.Annotations{
config.DisplayOrderAnnotation: cfgOptionDisableAutoPermitOrder,
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.CategoryAnnotation: "Advanced",
config.CategoryAnnotation: "Advanced",
},
PossibleValues: status.SecurityLevelValues,
})
Expand Down Expand Up @@ -208,6 +208,23 @@ Examples:
config.DisplayHintAnnotation: endpoints.DisplayHintEndpointList,
config.DisplayOrderAnnotation: cfgOptionServiceEndpointsOrder,
config.CategoryAnnotation: "Rules",
config.QuickSettingsAnnotation: []config.QuickSetting{
{
Name: "SSH",
Action: config.QuickMergeTop,
Value: []string{"+ * tcp/22"},
},
{
Name: "HTTP/s",
Action: config.QuickMergeTop,
Value: []string{"+ * tcp/80", "+ * tcp/443"},
},
{
Name: "RDP",
Action: config.QuickMergeTop,
Value: []string{"+ * */3389"},
},
},
},
ValidationRegex: `^(\+|\-) [A-z0-9\.:\-*/]+( [A-z0-9/]+)?$`,
})
Expand Down Expand Up @@ -248,7 +265,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionFilterCNAMEOrder,
config.CategoryAnnotation: "DNS",
config.CategoryAnnotation: "DNS",
},
PossibleValues: status.SecurityLevelValues,
})
Expand All @@ -269,7 +286,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionFilterSubDomainsOrder,
config.CategoryAnnotation: "DNS",
config.CategoryAnnotation: "DNS",
},
})
if err != nil {
Expand Down Expand Up @@ -391,7 +408,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionEnforceSPNOrder,
config.CategoryAnnotation: "Advanced",
config.CategoryAnnotation: "Advanced",
},
})
if err != nil {
Expand All @@ -413,7 +430,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionRemoveOutOfScopeDNSOrder,
config.CategoryAnnotation: "DNS",
config.CategoryAnnotation: "DNS",
},
})
if err != nil {
Expand All @@ -435,7 +452,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionRemoveBlockedDNSOrder,
config.CategoryAnnotation: "DNS",
config.CategoryAnnotation: "DNS",
},
})
if err != nil {
Expand All @@ -456,7 +473,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionDomainHeuristicsOrder,
config.CategoryAnnotation: "DNS",
config.CategoryAnnotation: "DNS",
},
})
if err != nil {
Expand All @@ -477,7 +494,7 @@ Examples:
Annotations: config.Annotations{
config.DisplayHintAnnotation: status.DisplayHintSecurityLevel,
config.DisplayOrderAnnotation: cfgOptionPreventBypassingOrder,
config.CategoryAnnotation: "Advanced",
config.CategoryAnnotation: "Advanced",
},
})
if err != nil {
Expand Down
35 changes: 35 additions & 0 deletions resolver/config.go
Expand Up @@ -112,8 +112,43 @@ Parameters:
DefaultValue: defaultNameServers,
ValidationRegex: fmt.Sprintf("^(%s|%s|%s)://.*", ServerTypeDoT, ServerTypeDNS, ServerTypeTCP),
Annotations: config.Annotations{
config.DisplayHintAnnotation: config.DisplayHintOrdered,
config.DisplayOrderAnnotation: cfgOptionNameServersOrder,
config.CategoryAnnotation: "Servers",
config.QuickSettingsAnnotation: []config.QuickSetting{
{
Name: "Quad9",
Action: config.QuickReplace,
Value: []string{
"dot://9.9.9.9:853?verify=dns.quad9.net&name=Quad9&blockedif=empty",
"dot://149.112.112.112:853?verify=dns.quad9.net&name=Quad9&blockedif=empty",
},
},
{
Name: "AdGuard",
Action: config.QuickReplace,
Value: []string{
"dot://94.140.14.14:853?verify=dns.adguard.com&name=AdGuard&blockedif=zeroip",
"dot://94.140.15.15:853?verify=dns.adguard.com&name=AdGuard&blockedif=zeroip",
},
},
{
Name: "Foundation for Applied Privacy",
Action: config.QuickReplace,
Value: []string{
"dot://94.130.106.88:853?verify=dot1.applied-privacy.net&name=AppliedPrivacy",
"dot://94.130.106.88:443?verify=dot1.applied-privacy.net&name=AppliedPrivacy",
},
},
{
Name: "Cloudflare",
Action: config.QuickReplace,
Value: []string{
"dot://1.1.1.2:853?verify=cloudflare-dns.com&name=Cloudflare&blockedif=zeroip",
"dot://1.0.0.2:853?verify=cloudflare-dns.com&name=Cloudflare&blockedif=zeroip",
},
},
},
},
})
if err != nil {
Expand Down

0 comments on commit 9ea2162

Please sign in to comment.