mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +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
13
listeners.go
13
listeners.go
|
@ -303,13 +303,19 @@ func IsUnixNetwork(netw string) bool {
|
|||
// Network addresses are distinct from URLs and do not
|
||||
// use URL syntax.
|
||||
func ParseNetworkAddress(addr string) (NetworkAddress, error) {
|
||||
return ParseNetworkAddressWithDefaults(addr, "tcp", 0)
|
||||
}
|
||||
|
||||
// ParseNetworkAddressWithDefaults is like ParseNetworkAddress but allows
|
||||
// the default network and port to be specified.
|
||||
func ParseNetworkAddressWithDefaults(addr, defaultNetwork string, defaultPort uint) (NetworkAddress, error) {
|
||||
var host, port string
|
||||
network, host, port, err := SplitNetworkAddress(addr)
|
||||
if err != nil {
|
||||
return NetworkAddress{}, err
|
||||
}
|
||||
if network == "" {
|
||||
network = "tcp"
|
||||
network = defaultNetwork
|
||||
}
|
||||
if IsUnixNetwork(network) {
|
||||
return NetworkAddress{
|
||||
|
@ -318,7 +324,10 @@ func ParseNetworkAddress(addr string) (NetworkAddress, error) {
|
|||
}, nil
|
||||
}
|
||||
var start, end uint64
|
||||
if port != "" {
|
||||
if port == "" {
|
||||
start = uint64(defaultPort)
|
||||
end = uint64(defaultPort)
|
||||
} else {
|
||||
before, after, found := strings.Cut(port, "-")
|
||||
if !found {
|
||||
after = before
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue