Reduce network load

This commit is contained in:
Neel Chauhan 2024-10-17 19:10:44 -04:00
parent 5e4619bae1
commit aaa59df308

View file

@ -690,10 +690,10 @@ func checkIsRelayURLAcceptable(
} }
if !allowPrivateIPs { if !allowPrivateIPs {
hostname := parsedRelayURL.Hostname() hostname := parsedRelayURL.Hostname()
ipArray, _ := net.LookupIP(hostname)
if isHostnameLocal(hostname) { if isHostnameLocal(hostname) {
return fmt.Errorf("rejected Relay URL: private hostnames are not allowed") return fmt.Errorf("rejected Relay URL: private hostnames are not allowed")
} }
ipArray, _ := net.LookupIP(hostname)
for _, ip := range ipArray { for _, ip := range ipArray {
if !isRemoteAddress(ip) { if !isRemoteAddress(ip) {
return fmt.Errorf("rejected Relay URL: private IPs are not allowed") return fmt.Errorf("rejected Relay URL: private IPs are not allowed")