mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-09-22 22:58:03 +03:00
Fix fillRequestHeader with nil inbound
This commit is contained in:
@@ -173,15 +173,18 @@ func fillRequestHeader(ctx context.Context, header []*Header) ([]*Header, error)
|
|||||||
outbounds := session.OutboundsFromContext(ctx)
|
outbounds := session.OutboundsFromContext(ctx)
|
||||||
ob := outbounds[len(outbounds)-1]
|
ob := outbounds[len(outbounds)-1]
|
||||||
|
|
||||||
if inbound == nil || ob == nil {
|
var src net.Destination
|
||||||
return nil, errors.New("missing inbound or outbound metadata from context")
|
if inbound != nil {
|
||||||
|
src = inbound.Source
|
||||||
|
} else {
|
||||||
|
src = net.TCPDestination(net.AnyIP, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
Source net.Destination
|
Source net.Destination
|
||||||
Target net.Destination
|
Target net.Destination
|
||||||
}{
|
}{
|
||||||
Source: inbound.Source,
|
Source: src,
|
||||||
Target: ob.Target,
|
Target: ob.Target,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user