mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-08 01:22:07 +08:00
15 lines
343 B
Go
15 lines
343 B
Go
package conntrack
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/sagernet/sing/service"
|
|
)
|
|
|
|
func ContextWithDefaultTracker(ctx context.Context, killerEnabled bool, memoryLimit uint64) context.Context {
|
|
if service.FromContext[Tracker](ctx) != nil {
|
|
return ctx
|
|
}
|
|
return service.ContextWith[Tracker](ctx, NewDefaultTracker(killerEnabled, memoryLimit))
|
|
}
|