1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

Revert "move away from dns.Server.ListenAndServe"

This reverts commit f0a801142d.
This commit is contained in:
Darien Raymond 2018-09-10 23:41:52 +02:00
parent f0a801142d
commit 813fdb6235
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -10,7 +10,6 @@ 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"
@ -43,19 +42,14 @@ 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{
PacketConn: listener,
Handler: &staticHandler{},
UDPSize: 1200,
Addr: "127.0.0.1:" + port.String(),
Net: "udp",
Handler: &staticHandler{},
UDPSize: 1200,
}
go dnsServer.ActivateAndServe()
go dnsServer.ListenAndServe()
time.Sleep(time.Second)
config := &core.Config{
@ -112,19 +106,14 @@ 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{
PacketConn: listener,
Handler: &staticHandler{},
UDPSize: 1200,
Addr: "127.0.0.1:" + port.String(),
Net: "udp",
Handler: &staticHandler{},
UDPSize: 1200,
}
go dnsServer.ActivateAndServe()
go dnsServer.ListenAndServe()
time.Sleep(time.Second)
config := &core.Config{