github.com/fzfile/BaiduPCS-Go@v0.0.0-20200606205115-4408961cf336/pcsutil/getip/getip_test.go (about) 1 package getip 2 3 import ( 4 "testing" 5 ) 6 7 func TestGetIP(t *testing.T) { 8 ipAddr, err := IPInfo(false) 9 if err != nil { 10 t.Errorf("err: %s\n", err) 11 return 12 } 13 14 t.Logf("from ipify: %s\n", ipAddr) 15 16 ipAddr, err = IPInfoFromNetease() 17 if err != nil { 18 t.Errorf("err: %s\n", err) 19 return 20 } 21 22 t.Logf("from netease: %s\n", ipAddr) 23 }