mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Allow multiple XUDP in Mux when using XTLS Vision (server side)
This commit is contained in:
parent
01b7e5e9be
commit
b33b0bc89d
3 changed files with 22 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
_ "unsafe"
|
||||
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/features/routing"
|
||||
)
|
||||
|
||||
|
@ -22,6 +23,7 @@ const (
|
|||
trackedConnectionErrorKey
|
||||
dispatcherKey
|
||||
timeoutOnlyKey
|
||||
allowedNetworkKey
|
||||
)
|
||||
|
||||
// ContextWithID returns a new context with the given ID.
|
||||
|
@ -147,3 +149,14 @@ func TimeoutOnlyFromContext(ctx context.Context) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ContextWithAllowedNetwork(ctx context.Context, network net.Network) context.Context {
|
||||
return context.WithValue(ctx, allowedNetworkKey, network)
|
||||
}
|
||||
|
||||
func AllowedNetworkFromContext(ctx context.Context) net.Network {
|
||||
if val, ok := ctx.Value(allowedNetworkKey).(net.Network); ok {
|
||||
return val
|
||||
}
|
||||
return net.Network_Unknown
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue