mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-25 11:53:11 +03:00
Add loopback check
This commit is contained in:
14
outbound/lookback.go
Normal file
14
outbound/lookback.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package outbound
|
||||
|
||||
import "context"
|
||||
|
||||
type outboundTagKey struct{}
|
||||
|
||||
func ContextWithTag(ctx context.Context, outboundTag string) context.Context {
|
||||
return context.WithValue(ctx, outboundTagKey{}, outboundTag)
|
||||
}
|
||||
|
||||
func TagFromContext(ctx context.Context) (string, bool) {
|
||||
value, loaded := ctx.Value(outboundTagKey{}).(string)
|
||||
return value, loaded
|
||||
}
|
||||
Reference in New Issue
Block a user