add proxyProtocol support for dialer
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
||||
"github.com/go-gost/core/dialer"
|
||||
"github.com/go-gost/core/logger"
|
||||
md "github.com/go-gost/core/metadata"
|
||||
ctxvalue "github.com/go-gost/x/ctx"
|
||||
"github.com/go-gost/x/internal/net/proxyproto"
|
||||
"github.com/go-gost/x/internal/util/mux"
|
||||
ws_util "github.com/go-gost/x/internal/util/ws"
|
||||
"github.com/go-gost/x/registry"
|
||||
@@ -87,6 +89,12 @@ func (d *mwsDialer) Dial(ctx context.Context, addr string, opts ...dialer.DialOp
|
||||
return
|
||||
}
|
||||
|
||||
conn = proxyproto.WrapClientConn(
|
||||
d.options.ProxyProtocol,
|
||||
ctxvalue.SrcAddrFromContext(ctx),
|
||||
ctxvalue.DstAddrFromContext(ctx),
|
||||
conn)
|
||||
|
||||
session = &muxSession{conn: conn}
|
||||
d.sessions[addr] = session
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user