* control, client: fix issues from review
This commit is contained in:
parent
9ea5c1abe1
commit
a01ba5dd4d
|
@ -22,7 +22,7 @@ const Examples = props => (
|
||||||
<code>sdns://...</code> - <span dangerouslySetInnerHTML={{ __html: props.t('example_upstream_sdns') }} />
|
<code>sdns://...</code> - <span dangerouslySetInnerHTML={{ __html: props.t('example_upstream_sdns') }} />
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<code>[/host.com/]1.1.1.1</code> - <span dangerouslySetInnerHTML={{ __html: props.t('example_upstream_reserved') }} />
|
<code>[/example.local/]1.1.1.1</code> - <span dangerouslySetInnerHTML={{ __html: props.t('example_upstream_reserved') }} />
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
11
control.go
11
control.go
|
@ -369,23 +369,22 @@ func validateUpstreams(upstreams []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateUpstream(u string) (defaultUpstream bool, err error) {
|
func validateUpstream(u string) (bool, error) {
|
||||||
// Check if user tries to specify upstream for domain
|
// Check if user tries to specify upstream for domain
|
||||||
defaultUpstream = true
|
u, defaultUpstream, err := separateUpstream(u)
|
||||||
u, defaultUpstream, err = separateUpstream(u)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return defaultUpstream, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// The special server address '#' means "use the default servers"
|
// The special server address '#' means "use the default servers"
|
||||||
if u == "#" && !defaultUpstream {
|
if u == "#" && !defaultUpstream {
|
||||||
return
|
return defaultUpstream, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the upstream has a valid protocol prefix
|
// Check if the upstream has a valid protocol prefix
|
||||||
for _, proto := range protocols {
|
for _, proto := range protocols {
|
||||||
if strings.HasPrefix(u, proto) {
|
if strings.HasPrefix(u, proto) {
|
||||||
return
|
return defaultUpstream, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue