From 392c16cd27719c2d7f4f1ea8cc29517988882c5a Mon Sep 17 00:00:00 2001 From: Aleksey Dmitrevskiy Date: Thu, 7 Mar 2019 16:32:52 +0300 Subject: [PATCH] [change] control: fix issues from review --- control.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/control.go b/control.go index 4ca0f023..0cd9d504 100644 --- a/control.go +++ b/control.go @@ -27,6 +27,8 @@ const updatePeriod = time.Minute * 30 var versionCheckJSON []byte var versionCheckLastTime time.Time +var protocols = []string{"tls://", "https://", "tcp://", "sdns://"} + const versionCheckURL = "https://adguardteam.github.io/AdGuardHome/version.json" const versionCheckPeriod = time.Hour * 8 @@ -342,8 +344,10 @@ func handleSetUpstreamConfig(w http.ResponseWriter, r *http.Request) { } func validateUpstream(upstream string) error { - if strings.HasPrefix(upstream, "tls://") || strings.HasPrefix(upstream, "https://") || strings.HasPrefix(upstream, "sdns://") || strings.HasPrefix(upstream, "tcp://") { - return nil + for _, proto := range protocols { + if strings.HasPrefix(upstream, proto) { + return nil + } } if strings.Contains(upstream, "://") {