mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-24 01:21:30 +00:00
15 lines
347 B
Go
15 lines
347 B
Go
|
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
|
||
|
}
|