1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-22 02:39:55 -04:00

refactor app.Space

This commit is contained in:
v2ray
2016-01-31 17:01:28 +01:00
parent fcf8a74a3a
commit 2031c13a7f
40 changed files with 487 additions and 480 deletions

View File

@@ -4,7 +4,6 @@ import (
"net"
"sync"
"github.com/v2ray/v2ray-core/app"
v2io "github.com/v2ray/v2ray-core/common/io"
"github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net"
@@ -14,7 +13,6 @@ import (
)
type FreedomConnection struct {
space app.Space
}
func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.OutboundRay) error {
@@ -77,19 +75,6 @@ func (this *FreedomConnection) Dispatch(firstPacket v2net.Packet, ray ray.Outbou
v2io.RawReaderToChan(output, conn)
}()
if this.space.HasDnsCache() {
if firstPacket.Destination().Address().IsDomain() {
domain := firstPacket.Destination().Address().Domain()
addr := conn.RemoteAddr()
switch typedAddr := addr.(type) {
case *net.TCPAddr:
this.space.DnsCache().Add(domain, typedAddr.IP)
case *net.UDPAddr:
this.space.DnsCache().Add(domain, typedAddr.IP)
}
}
}
writeMutex.Lock()
if tcpConn, ok := conn.(*net.TCPConn); ok {
tcpConn.CloseWrite()