1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-30 14:05:26 -05:00

refine dispatcher

This commit is contained in:
Darien Raymond
2016-11-13 14:33:00 +01:00
parent 5dc05d6352
commit 9471b5b066
13 changed files with 31 additions and 27 deletions

View File

@@ -90,7 +90,7 @@ func (this *DokodemoDoor) Start() error {
}
func (this *DokodemoDoor) ListenUDP() error {
this.udpServer = udp.NewUDPServer(this.meta, this.packetDispatcher)
this.udpServer = udp.NewUDPServer(this.packetDispatcher)
udpHub, err := udp.ListenUDP(
this.meta.Address, this.meta.Port, udp.ListenOption{
Callback: this.handleUDPPackets,
@@ -114,6 +114,7 @@ func (this *DokodemoDoor) handleUDPPackets(payload *alloc.Buffer, session *proxy
log.Info("Dokodemo: Unknown destination, stop forwarding...")
return
}
session.Inbound = this.meta
this.udpServer.Dispatch(session, payload, this.handleUDPResponse)
}
@@ -160,9 +161,10 @@ func (this *DokodemoDoor) HandleTCPConnection(conn internet.Connection) {
}
log.Info("Dokodemo: Handling request to ", dest)
ray := this.packetDispatcher.DispatchToOutbound(this.meta, &proxy.SessionInfo{
ray := this.packetDispatcher.DispatchToOutbound(&proxy.SessionInfo{
Source: v2net.DestinationFromAddr(conn.RemoteAddr()),
Destination: dest,
Inbound: this.meta,
})
defer ray.InboundOutput().Release()