Files
sing-box-extended-mirror/adapter/security.go
T

20 lines
372 B
Go
Raw Normal View History

2026-07-15 19:31:11 +08:00
package adapter
import (
"context"
"github.com/sagernet/sing/service"
)
type SecurityPolicy interface {
2026-07-20 22:00:35 +08:00
CheckFeature(ctx context.Context, feature string) error
2026-07-15 19:31:11 +08:00
}
func CheckSecurityFeature(ctx context.Context, feature string) error {
policy := service.FromContext[SecurityPolicy](ctx)
if policy == nil {
return nil
}
2026-07-20 22:00:35 +08:00
return policy.CheckFeature(ctx, feature)
2026-07-15 19:31:11 +08:00
}