src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

digip_test.go (820B)


      1 package digip
      2 
      3 import (
      4 	"context"
      5 	"testing"
      6 )
      7 
      8 func TestGoogleV4(t *testing.T) {
      9 	ctx := context.Background()
     10 
     11 	ip, err := Google(ctx, V4)
     12 	if err != nil {
     13 		t.Errorf("google v4 failed: %v", err)
     14 		return
     15 	}
     16 
     17 	t.Logf("got ip: %s", ip)
     18 }
     19 
     20 func TestGoogleV6(t *testing.T) {
     21 	ctx := context.Background()
     22 
     23 	ip, err := Google(ctx, V6)
     24 	if err != nil {
     25 		t.Errorf("google v6 failed: %v", err)
     26 		return
     27 	}
     28 
     29 	t.Logf("got ip: %s", ip)
     30 }
     31 
     32 func TestOpenDNSV4(t *testing.T) {
     33 	ctx := context.Background()
     34 
     35 	ip, err := OpenDNS(ctx, A)
     36 	if err != nil {
     37 		t.Errorf("opendns A failed: %v", err)
     38 		return
     39 	}
     40 
     41 	t.Logf("got ip: %s", ip)
     42 }
     43 
     44 func TestOpenDNSV6(t *testing.T) {
     45 	ctx := context.Background()
     46 
     47 	ip, err := OpenDNS(ctx, AAAA)
     48 	if err != nil {
     49 		t.Errorf("opendns AAAA failed: %v", err)
     50 		return
     51 	}
     52 
     53 	t.Logf("got ip: %s", ip)
     54 }