mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-02 17:27:50 -04:00
24 lines
477 B
Go
24 lines
477 B
Go
package dns_test
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/v2ray/v2ray-core/app/dns"
|
|
netassert "github.com/v2ray/v2ray-core/common/net/testing/assert"
|
|
v2testing "github.com/v2ray/v2ray-core/testing"
|
|
)
|
|
|
|
func TestDnsAdd(t *testing.T) {
|
|
v2testing.Current(t)
|
|
|
|
domain := "v2ray.com"
|
|
cache := dns.NewCache()
|
|
ip := cache.Get(domain)
|
|
netassert.IP(ip).IsNil()
|
|
|
|
cache.Add(domain, []byte{1, 2, 3, 4})
|
|
ip = cache.Get(domain)
|
|
netassert.IP(ip).Equals(net.IP([]byte{1, 2, 3, 4}))
|
|
}
|