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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user