mirror of https://github.com/v2ray/v2ray-core
parent
679d646571
commit
8a5f37dad7
|
@ -22,7 +22,9 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
if err := json.Unmarshal(data, rawConfig); err != nil {
|
if err := json.Unmarshal(data, rawConfig); err != nil {
|
||||||
return errors.New("Dokodemo: Failed to parse config: " + err.Error())
|
return errors.New("Dokodemo: Failed to parse config: " + err.Error())
|
||||||
}
|
}
|
||||||
|
if rawConfig.Host != nil {
|
||||||
this.Address = rawConfig.Host.Address
|
this.Address = rawConfig.Host.Address
|
||||||
|
}
|
||||||
this.Port = rawConfig.PortValue
|
this.Port = rawConfig.PortValue
|
||||||
this.Network = rawConfig.NetworkList
|
this.Network = rawConfig.NetworkList
|
||||||
this.Timeout = rawConfig.TimeoutValue
|
this.Timeout = rawConfig.TimeoutValue
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (this *DokodemoDoor) ListenTCP() error {
|
||||||
func (this *DokodemoDoor) HandleTCPConnection(conn *hub.Connection) {
|
func (this *DokodemoDoor) HandleTCPConnection(conn *hub.Connection) {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
dest := v2net.TCPDestination(this.address, this.port)
|
var dest v2net.Destination
|
||||||
if this.config.FollowRedirect {
|
if this.config.FollowRedirect {
|
||||||
originalDest := GetOriginalDestination(conn)
|
originalDest := GetOriginalDestination(conn)
|
||||||
if originalDest != nil {
|
if originalDest != nil {
|
||||||
|
@ -137,6 +137,14 @@ func (this *DokodemoDoor) HandleTCPConnection(conn *hub.Connection) {
|
||||||
dest = originalDest
|
dest = originalDest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if dest == nil && this.address != nil && this.port > v2net.Port(0) {
|
||||||
|
dest = v2net.TCPDestination(this.address, this.port)
|
||||||
|
}
|
||||||
|
|
||||||
|
if dest == nil {
|
||||||
|
log.Info("Dokodemo: Unknown destination, stop forwarding...")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ray := this.packetDispatcher.DispatchToOutbound(dest)
|
ray := this.packetDispatcher.DispatchToOutbound(dest)
|
||||||
defer ray.InboundOutput().Release()
|
defer ray.InboundOutput().Release()
|
||||||
|
|
Loading…
Reference in New Issue