mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-27 04:07:28 +00:00
acmeserver: Configurable resolvers, fix smallstep deprecations (#5500)
* acmeserver: Configurable `resolvers`, fix smallstep deprecations * Improve default net/port * Update proxy resolvers parsing to use the new function * Update listeners.go Co-authored-by: itsxaos <33079230+itsxaos@users.noreply.github.com> --------- Co-authored-by: itsxaos <33079230+itsxaos@users.noreply.github.com>
This commit is contained in:
parent
1af419e7ec
commit
3f20a7c9f3
5 changed files with 284 additions and 53 deletions
|
|
@ -8,7 +8,6 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -471,16 +470,9 @@ type UpstreamResolver struct {
|
|||
// and ensures they're ready to be used.
|
||||
func (u *UpstreamResolver) ParseAddresses() error {
|
||||
for _, v := range u.Addresses {
|
||||
addr, err := caddy.ParseNetworkAddress(v)
|
||||
addr, err := caddy.ParseNetworkAddressWithDefaults(v, "udp", 53)
|
||||
if err != nil {
|
||||
// If a port wasn't specified for the resolver,
|
||||
// try defaulting to 53 and parse again
|
||||
if strings.Contains(err.Error(), "missing port in address") {
|
||||
addr, err = caddy.ParseNetworkAddress(v + ":53")
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
if addr.PortRangeSize() != 1 {
|
||||
return fmt.Errorf("resolver address must have exactly one address; cannot call %v", addr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue