File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
package data
2
2
3
3
import (
4
+ "errors"
4
5
"net"
5
6
"strings"
6
7
)
@@ -15,7 +16,12 @@ type InternalData struct {
15
16
func (i * InternalData ) GetInternalIP () {
16
17
17
18
conn , err := net .Dial ("udp" , "8.8.8.8:80" )
18
- checkErr (err )
19
+
20
+ defer func () {
21
+ if r := recover (); r != nil {
22
+ checkErr (errors .Join (err , r .(error )))
23
+ }
24
+ }()
19
25
defer conn .Close ()
20
26
21
27
localAddr := conn .LocalAddr ().(* net.UDPAddr )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ func TestGetInternalIP(t *testing.T) {
13
13
14
14
// assert
15
15
if result == "" {
16
- t .Errorf ("Wrong internal IP address! Shoud be fromat like this XX.XX.XX.XX %s\n " , result )
16
+ t .Errorf ("Wrong internal IP address! Shoud be format like this XX.XX.XX.XX %s\n " , result )
17
17
}
18
18
}
19
19
You can’t perform that action at this time.
0 commit comments