mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 10:00:34 +00:00
Proxy: Add Hysteria 2 inbound & transport (supports listening port range, Salamander finalmask) (#5679)
https://github.com/XTLS/Xray-core/pull/5679#issuecomment-3888548778 Closes https://github.com/XTLS/Xray-core/issues/5605
This commit is contained in:
@@ -2,12 +2,15 @@ package ctx
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/xtls/xray-core/proxy/hysteria/account"
|
||||
)
|
||||
|
||||
type key int
|
||||
|
||||
const (
|
||||
requireDatagram key = iota
|
||||
validator
|
||||
)
|
||||
|
||||
func ContextWithRequireDatagram(ctx context.Context, udp bool) context.Context {
|
||||
@@ -21,3 +24,12 @@ func RequireDatagramFromContext(ctx context.Context) bool {
|
||||
_, ok := ctx.Value(requireDatagram).(struct{})
|
||||
return ok
|
||||
}
|
||||
|
||||
func ContextWithValidator(ctx context.Context, v *account.Validator) context.Context {
|
||||
return context.WithValue(ctx, validator, v)
|
||||
}
|
||||
|
||||
func ValidatorFromContext(ctx context.Context) *account.Validator {
|
||||
v, _ := ctx.Value(validator).(*account.Validator)
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user