github.com/tickstep/library-go@v0.1.1/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  
    24  	ipAddr, err = IPInfoFromTechainBaidu()
    25  	t.Logf("from baidu: %s\n", ipAddr)
    26  }