Introduce Packet to unify TCP and UDP communication

This commit is contained in:
V2Ray committed 2015-09-22 14:45:03 +02:00
1 parent 4320c14efd
commit 4874cd54a4
12 files changed
+124 -41

No files matched your search

+3 -3
View File
@@ -64,7 +64,7 @@ type InboundConnectionHandler interface {
}
type OutboundConnectionHandlerFactory interface {
Create(VP *Point, config []byte, dest v2net.Destination) (OutboundConnectionHandler, error)
Create(VP *Point, config []byte, firstPacket v2net.Packet) (OutboundConnectionHandler, error)
}
type OutboundConnectionHandler interface {
@@ -85,10 +85,10 @@ func (vp *Point) Start() error {
return nil
}
func (vp *Point) NewInboundConnectionAccepted(destination v2net.Destination) InboundRay {
func (p *Point) DispatchToOutbound(packet v2net.Packet) InboundRay {
ray := NewRay()
// TODO: handle error
och, _ := vp.ochFactory.Create(vp, vp.ochConfig, destination)
och, _ := p.ochFactory.Create(p, p.ochConfig, packet)
_ = och.Start(ray)
return ray
}