| 29 | } |
| 30 | |
| 31 | func (p parsedAddr) dialAddr() string { |
| 32 | if !p.valid { |
| 33 | return "" |
| 34 | } |
| 35 | // for simplest possible config, we only need to include |
| 36 | // the network portion if the user specified one |
| 37 | if p.network != "" { |
| 38 | return caddy.JoinNetworkAddress(p.network, p.host, p.port) |
| 39 | } |
| 40 | |
| 41 | // if the host is a placeholder, then we don't want to join with an empty port, |
| 42 | // because that would just append an extra ':' at the end of the address. |
| 43 | if p.port == "" && strings.Contains(p.host, "{") { |
| 44 | return p.host |
| 45 | } |
| 46 | return net.JoinHostPort(p.host, p.port) |
| 47 | } |
| 48 | |
| 49 | func (p parsedAddr) rangedPort() bool { |
| 50 | return strings.Contains(p.port, "-") |