mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-08 14:39:04 +08:00
fix: avoid panic by handling getOutboundIP() error
This commit is contained in:
parent
05c79b7119
commit
56c9ea5430
@ -61,6 +61,10 @@ func getOutboundIP() string {
|
|||||||
ip := []byte("NA")
|
ip := []byte("NA")
|
||||||
resp, err := http.Get("https://api.ipify.org?format=text")
|
resp, err := http.Get("https://api.ipify.org?format=text")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ipBody, err := ioutil.ReadAll(resp.Body)
|
ipBody, err := ioutil.ReadAll(resp.Body)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user