@@ -289,28 +289,28 @@ convert_plugin_names_to_filter_names() {
289
289
# that at least one works
290
290
# ##################################################################
291
291
get_public_ip () {
292
- local services=(https://ipinfo.io/ip https://ifconfig.me/ip https://icanhazip.com https://ipecho.net/ip https://ifconfig.co https://myexternalip.com/raw)
292
+ local services=(https://ipinfo.io/ip https://ifconfig.me/ip https://icanhazip.com https://ipecho.net/ip https://ifconfig.co https://myexternalip.com/raw)
293
293
local ip
294
- if [[ -n " ${AUTOSET_HOSTNAME_SERVICES} " ]]; then
295
- services=(" ${AUTOSET_HOSTNAME_SERVICES} " )
296
- notice " Using user defined ${emphasis} AUTOSET_HOSTNAME_SERVICES${reset} =${emphasis}${AUTOSET_HOSTNAME_SERVICES}${reset} for IP detection"
297
- else
298
- debug " Public IP detection will use ${emphasis}${services}${reset} to detect the IP."
299
- fi
300
-
301
- for service in " ${services[@]} " ; do
302
- if ip=" $( curl --fail-early --retry-max-time 30 --retry 10 --connect-timeout 5 --max-time 10 -s) " ; then
303
- # Some services, such as ifconfig.co will return a line feed at the end of the response.
304
- ip=" $( printf " %s" " ${ip} " | trim) "
305
- if [[ -n " ${ip} " ]]; then
306
- info " Detected public IP address as ${emphasis}${services}${ip}${reset} ."
307
- break
308
- fi
309
- fi
310
- done
311
-
312
- error " Unable to detect public IP. Please check your internet connection and firewall settings."
313
- return 1
294
+ if [[ -n " ${AUTOSET_HOSTNAME_SERVICES} " ]]; then
295
+ services=(" ${AUTOSET_HOSTNAME_SERVICES} " )
296
+ notice " Using user defined ${emphasis} AUTOSET_HOSTNAME_SERVICES${reset} =${emphasis}${AUTOSET_HOSTNAME_SERVICES}${reset} for IP detection"
297
+ else
298
+ debug " Public IP detection will use ${emphasis}${services}${reset} to detect the IP."
299
+ fi
300
+
301
+ for service in " ${services[@]} " ; do
302
+ if ip=" $( curl --fail-early --retry-max-time 30 --retry 10 --connect-timeout 5 --max-time 10 -s) " ; then
303
+ # Some services, such as ifconfig.co will return a line feed at the end of the response.
304
+ ip=" $( printf " %s" " ${ip} " | trim) "
305
+ if [[ -n " ${ip} " ]]; then
306
+ info " Detected public IP address as ${emphasis}${services}${ip}${reset} ."
307
+ break
308
+ fi
309
+ fi
310
+ done
311
+
312
+ error " Unable to detect public IP. Please check your internet connection and firewall settings."
313
+ return 1
314
314
}
315
315
316
316
export reset green yellow orange orange_emphasis lightblue red gray emphasis underline
0 commit comments