1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -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/policy"
"v2ray.com/core/app/proxyman" "v2ray.com/core/app/proxyman"
_ "v2ray.com/core/app/proxyman/outbound" _ "v2ray.com/core/app/proxyman/outbound"
"v2ray.com/core/common"
"v2ray.com/core/common/net" "v2ray.com/core/common/net"
"v2ray.com/core/common/serial" "v2ray.com/core/common/serial"
"v2ray.com/core/proxy/freedom" "v2ray.com/core/proxy/freedom"
@ -43,19 +42,14 @@ func TestUDPServer(t *testing.T) {
port := udp.PickPort() 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{ dnsServer := dns.Server{
PacketConn: listener, Addr: "127.0.0.1:" + port.String(),
Handler: &staticHandler{}, Net: "udp",
UDPSize: 1200, Handler: &staticHandler{},
UDPSize: 1200,
} }
go dnsServer.ActivateAndServe() go dnsServer.ListenAndServe()
time.Sleep(time.Second) time.Sleep(time.Second)
config := &core.Config{ config := &core.Config{
@ -112,19 +106,14 @@ func TestPrioritizedDomain(t *testing.T) {
port := udp.PickPort() 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{ dnsServer := dns.Server{
PacketConn: listener, Addr: "127.0.0.1:" + port.String(),
Handler: &staticHandler{}, Net: "udp",
UDPSize: 1200, Handler: &staticHandler{},
UDPSize: 1200,
} }
go dnsServer.ActivateAndServe() go dnsServer.ListenAndServe()
time.Sleep(time.Second) time.Sleep(time.Second)
config := &core.Config{ config := &core.Config{