github.com/iikira/iikira-go-utils@v0.0.0-20230610031953-f2cb11cde33a/utils/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  }