1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-27 01:45:23 +00:00

move away from dns.Server.ListenAndServe

This commit is contained in:
Darien Raymond 2018-09-10 22:58:37 +02:00
parent dad0892a39
commit f0a801142d
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -10,6 +10,7 @@ import (
"v2ray.com/core/app/policy"
"v2ray.com/core/app/proxyman"
_ "v2ray.com/core/app/proxyman/outbound"
"v2ray.com/core/common"
"v2ray.com/core/common/net"
"v2ray.com/core/common/serial"
"v2ray.com/core/proxy/freedom"
@ -42,14 +43,19 @@ func TestUDPServer(t *testing.T) {
port := udp.PickPort()
listener, err := net.ListenUDP("udp4", &net.UDPAddr{
IP: net.IP{127, 0, 0, 1},
Port: int(port),
})
common.Must(err)
dnsServer := dns.Server{
Addr: "127.0.0.1:" + port.String(),
Net: "udp",
Handler: &staticHandler{},
UDPSize: 1200,
PacketConn: listener,
Handler: &staticHandler{},
UDPSize: 1200,
}
go dnsServer.ListenAndServe()
go dnsServer.ActivateAndServe()
time.Sleep(time.Second)
config := &core.Config{
@ -106,14 +112,19 @@ func TestPrioritizedDomain(t *testing.T) {
port := udp.PickPort()
listener, err := net.ListenUDP("udp4", &net.UDPAddr{
IP: net.IP{127, 0, 0, 1},
Port: int(port),
})
common.Must(err)
dnsServer := dns.Server{
Addr: "127.0.0.1:" + port.String(),
Net: "udp",
Handler: &staticHandler{},
UDPSize: 1200,
PacketConn: listener,
Handler: &staticHandler{},
UDPSize: 1200,
}
go dnsServer.ListenAndServe()
go dnsServer.ActivateAndServe()
time.Sleep(time.Second)
config := &core.Config{