github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/proxy/socks5/server_test.go (about) 1 package socks5 2 3 import ( 4 "bytes" 5 "testing" 6 7 "github.com/Asutorufa/yuhaiin/pkg/net/netapi" 8 "github.com/Asutorufa/yuhaiin/pkg/net/proxy/socks5/tools" 9 "github.com/Asutorufa/yuhaiin/pkg/protos/statistic" 10 ) 11 12 func TestResolveAddr(t *testing.T) { 13 port := netapi.ParsePort(443) 14 15 x := tools.ParseAddr(netapi.ParseAddressPort(statistic.Type_tcp, "www.baidu.com", port)) 16 t.Log(tools.ResolveAddr(bytes.NewBuffer(x.Bytes.Bytes()))) 17 18 x = tools.ParseAddr(netapi.ParseAddressPort(statistic.Type_tcp, "127.0.0.1", port)) 19 // t.Log(x[0], x[1], x[2], x[3], x[4], x[3:], x[:3], x[:]) 20 t.Log(tools.ResolveAddr(bytes.NewBuffer(x.Bytes.Bytes()))) 21 22 x = tools.ParseAddr(netapi.ParseAddressPort(statistic.Type_tcp, "[ff::ff]", port)) 23 t.Log(tools.ResolveAddr(bytes.NewBuffer(x.Bytes.Bytes()))) 24 }