All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m18s
Test / Hakurei (push) Successful in 3m10s
Test / Sandbox (race detector) (push) Successful in 3m30s
Test / Hakurei (race detector) (push) Successful in 4m43s
Test / Fpkg (push) Successful in 5m4s
Test / Flake checks (push) Successful in 1m12s
Fortify makes little sense for a container tool. Signed-off-by: Ophestra <cat@gensokyo.uk>
34 lines
728 B
Go
34 lines
728 B
Go
// Package instance exposes cross-package implementation details and provides constructors for builtin implementations.
|
|
package instance
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"syscall"
|
|
|
|
"git.gensokyo.uk/security/hakurei/internal/app"
|
|
"git.gensokyo.uk/security/hakurei/internal/app/internal/setuid"
|
|
"git.gensokyo.uk/security/hakurei/internal/sys"
|
|
)
|
|
|
|
const (
|
|
ISetuid = iota
|
|
)
|
|
|
|
func New(whence int, ctx context.Context, os sys.State) (app.App, error) {
|
|
switch whence {
|
|
case ISetuid:
|
|
return setuid.New(ctx, os)
|
|
default:
|
|
return nil, syscall.EINVAL
|
|
}
|
|
}
|
|
|
|
func MustNew(whence int, ctx context.Context, os sys.State) app.App {
|
|
a, err := New(whence, ctx, os)
|
|
if err != nil {
|
|
log.Fatalf("cannot create app: %v", err)
|
|
}
|
|
return a
|
|
}
|