| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 | package mdnsimport (	"fmt"	"net"	"testing"	"golib/v2/pkg/mdns")const (	LocalName = "simanc-test.local")func TestListenAndServe(t *testing.T) {	err := ListenAndServe(LocalName)	if err != nil {		t.Error(err)	}}func TestLookup(t *testing.T) {	ips, err := Lookup(LocalName)	if err != nil {		t.Error(err)		return	}	t.Log(ips)}func TestLookups(t *testing.T) {	names := []string{		Fqdn("a.simanc-test"),		Fqdn("b.simanc-test"),		Fqdn("c.simanc-test"),	}	go func() {		if err := ListenAndServeNames(names); err != nil {			panic(err)		}	}()	ips, err := Lookups(names)	if err != nil {		t.Error(err)		return	}	t.Log(ips)}func TestClient_ListenAndServe(t *testing.T) {	client := &Client{		Name:    []string{LocalName},		Address: mdns.Address,		Handle:  clientHandler,	}	if err := client.ListenAndServe(); err != nil {		t.Error(err)	}}func clientHandler(name string, addr net.IP) {	fmt.Println("Name:", name, "Addr:", addr)}
 |