mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-17 22:57:10 +00:00
dns cache command
This commit is contained in:
1 parent
367d17b44c
commit
8d6fdd014a
3 files changed
+113
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package command_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/v2ray/v2ray-core/common/alloc"
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
netassert "github.com/v2ray/v2ray-core/common/net/testing/assert"
|
||||
. "github.com/v2ray/v2ray-core/proxy/vmess/command"
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func TestCacheDnsIPv4(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
|
||||
cd := &CacheDns{
|
||||
Address: v2net.IPAddress([]byte{1, 2, 3, 4}),
|
||||
}
|
||||
|
||||
buffer := alloc.NewBuffer().Clear()
|
||||
defer buffer.Release()
|
||||
|
||||
nBytes, err := cd.Marshal(buffer)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(nBytes).Equals(buffer.Len())
|
||||
|
||||
cd2 := &CacheDns{}
|
||||
err = cd2.Unmarshal(buffer.Value)
|
||||
assert.Error(err).IsNil()
|
||||
netassert.Address(cd.Address).Equals(cd2.Address)
|
||||
}
|
||||
Reference in new issue
Block a user