From 694d924cc7a4557e2cc52ad3f5a564674092dfea Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sat, 14 Dec 2019 18:13:33 +0800 Subject: [PATCH] Fix: valid proxy group and remove unused code --- adapters/outboundgroup/parser.go | 6 ++++++ dns/doh.go | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/adapters/outboundgroup/parser.go b/adapters/outboundgroup/parser.go index 972305c2..944976f1 100644 --- a/adapters/outboundgroup/parser.go +++ b/adapters/outboundgroup/parser.go @@ -13,6 +13,7 @@ var ( errFormat = errors.New("format error") errType = errors.New("unsupport type") errMissUse = errors.New("`use` field should not be empty") + errMissProxy = errors.New("`use` or `proxies` missing") errMissHealthCheck = errors.New("`url` or `interval` missing") errDuplicateProvider = errors.New("`duplicate provider name") ) @@ -41,6 +42,11 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy, groupName := groupOption.Name providers := []provider.ProxyProvider{} + + if len(groupOption.Proxies) == 0 && len(groupOption.Use) == 0 { + return nil, errMissProxy + } + if len(groupOption.Proxies) != 0 { ps, err := getProxies(proxyMap, groupOption.Proxies) if err != nil { diff --git a/dns/doh.go b/dns/doh.go index 51a69df5..d8d60772 100644 --- a/dns/doh.go +++ b/dns/doh.go @@ -13,9 +13,6 @@ import ( const ( // dotMimeType is the DoH mimetype that should be used. dotMimeType = "application/dns-message" - - // dotPath is the URL path that should be used. - dotPath = "/dns-query" ) var dohTransport = &http.Transport{