mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-09-17 23:22:27 +02:00
32 lines
715 B
Go
32 lines
715 B
Go
//go:build !linux && !windows
|
|
|
|
package processguard
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
func configurePlatform(o *Options) error {
|
|
if o.Mode == "required" || o.CgroupRoot != "" {
|
|
return fmt.Errorf("kernel task containment is unavailable on this OS; use a Linux cgroup deployment")
|
|
}
|
|
return nil
|
|
}
|
|
func newPlatformGroup(id string, o Options) (Group, error) {
|
|
if err := configurePlatform(&o); err != nil {
|
|
return nil, err
|
|
}
|
|
return newUnixGroup()
|
|
}
|
|
func guardianMain(dec *json.Decoder, enc *json.Encoder) error {
|
|
var req watchRequest
|
|
if err := dec.Decode(&req); err != nil {
|
|
return err
|
|
}
|
|
if req.Name != "process_group" {
|
|
return fmt.Errorf("unsupported guardian")
|
|
}
|
|
return groupGuardian(dec, enc)
|
|
}
|