Fix: valid proxy group and remove unused code
This commit is contained in:
parent
7a498cdb5e
commit
694d924cc7
2 changed files with 6 additions and 3 deletions
|
@ -13,6 +13,7 @@ var (
|
||||||
errFormat = errors.New("format error")
|
errFormat = errors.New("format error")
|
||||||
errType = errors.New("unsupport type")
|
errType = errors.New("unsupport type")
|
||||||
errMissUse = errors.New("`use` field should not be empty")
|
errMissUse = errors.New("`use` field should not be empty")
|
||||||
|
errMissProxy = errors.New("`use` or `proxies` missing")
|
||||||
errMissHealthCheck = errors.New("`url` or `interval` missing")
|
errMissHealthCheck = errors.New("`url` or `interval` missing")
|
||||||
errDuplicateProvider = errors.New("`duplicate provider name")
|
errDuplicateProvider = errors.New("`duplicate provider name")
|
||||||
)
|
)
|
||||||
|
@ -41,6 +42,11 @@ func ParseProxyGroup(config map[string]interface{}, proxyMap map[string]C.Proxy,
|
||||||
groupName := groupOption.Name
|
groupName := groupOption.Name
|
||||||
|
|
||||||
providers := []provider.ProxyProvider{}
|
providers := []provider.ProxyProvider{}
|
||||||
|
|
||||||
|
if len(groupOption.Proxies) == 0 && len(groupOption.Use) == 0 {
|
||||||
|
return nil, errMissProxy
|
||||||
|
}
|
||||||
|
|
||||||
if len(groupOption.Proxies) != 0 {
|
if len(groupOption.Proxies) != 0 {
|
||||||
ps, err := getProxies(proxyMap, groupOption.Proxies)
|
ps, err := getProxies(proxyMap, groupOption.Proxies)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,9 +13,6 @@ import (
|
||||||
const (
|
const (
|
||||||
// dotMimeType is the DoH mimetype that should be used.
|
// dotMimeType is the DoH mimetype that should be used.
|
||||||
dotMimeType = "application/dns-message"
|
dotMimeType = "application/dns-message"
|
||||||
|
|
||||||
// dotPath is the URL path that should be used.
|
|
||||||
dotPath = "/dns-query"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var dohTransport = &http.Transport{
|
var dohTransport = &http.Transport{
|
||||||
|
|
Loading…
Reference in a new issue