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

receive handshake address from tls conn

This commit is contained in:
Darien Raymond
2018-07-14 13:58:24 +02:00
parent 9a9b6f9077
commit 14dc6371d3
2 changed files with 23 additions and 2 deletions

View File

@@ -54,6 +54,10 @@ func (d *DokodemoDoor) policy() core.Policy {
return p
}
type hasHandshakeAddress interface {
HandshakeAddress() net.Address
}
func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher core.Dispatcher) error {
newError("processing connection from: ", conn.RemoteAddr()).AtDebug().WriteToLog(session.ExportIDToError(ctx))
dest := net.Destination{
@@ -65,6 +69,12 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
if origDest, ok := proxy.OriginalTargetFromContext(ctx); ok {
dest = origDest
}
if handshake, ok := conn.(hasHandshakeAddress); ok {
addr := handshake.HandshakeAddress()
if addr != nil {
dest.Address = addr
}
}
}
if !dest.IsValid() || dest.Address == nil {
return newError("unable to get destination")