aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-07-29 03:06:49 +0900
committerOphestra <cat@gensokyo.uk>2025-07-29 03:06:49 +0900
commitf7bd28118c4ac34a9a444073b31ca8f2579188f3 (patch)
treed094700b4d367250e9de16226cc7cc49a0dc3b55 /hst
parent940ee00ffee9208a244a99ff085a981c1af1d7c4 (diff)
hst: configurable wait delay
This is useful for programs that take a long time to clean up. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst')
-rw-r--r--hst/container.go8
-rw-r--r--hst/template.go24
-rw-r--r--hst/template_test.go2
3 files changed, 19 insertions, 15 deletions
diff --git a/hst/container.go b/hst/container.go
index 1ee9e839..c385344c 100644
--- a/hst/container.go
+++ b/hst/container.go
@@ -1,6 +1,8 @@
package hst
import (
+ "time"
+
"hakurei.app/container/seccomp"
)
@@ -10,8 +12,10 @@ type (
// container hostname
Hostname string `json:"hostname,omitempty"`
- // do not interrupt and wait for initial process during termination
- ImmediateTermination bool `json:"immediate_termination,omitempty"`
+ // duration to wait for after interrupting a container's initial process in nanoseconds;
+ // a negative value causes the container to be terminated immediately on cancellation
+ WaitDelay time.Duration `json:"wait_delay,omitempty"`
+
// extra seccomp flags
SeccompFlags seccomp.ExportFlag `json:"seccomp_flags"`
// extra seccomp presets
diff --git a/hst/template.go b/hst/template.go
index 60af2ebc..3ab9c277 100644
--- a/hst/template.go
+++ b/hst/template.go
@@ -57,18 +57,18 @@ func Template() *Config {
Groups: []string{"video", "dialout", "plugdev"},
Container: &ContainerConfig{
- Hostname: "localhost",
- Devel: true,
- Userns: true,
- Net: true,
- Device: true,
- ImmediateTermination: true,
- SeccompFlags: seccomp.AllowMultiarch,
- SeccompPresets: seccomp.PresetExt,
- SeccompCompat: true,
- Tty: true,
- Multiarch: true,
- MapRealUID: true,
+ Hostname: "localhost",
+ Devel: true,
+ Userns: true,
+ Net: true,
+ Device: true,
+ WaitDelay: -1,
+ SeccompFlags: seccomp.AllowMultiarch,
+ SeccompPresets: seccomp.PresetExt,
+ SeccompCompat: true,
+ Tty: true,
+ Multiarch: true,
+ MapRealUID: true,
// example API credentials pulled from Google Chrome
// DO NOT USE THESE IN A REAL BROWSER
Env: map[string]string{
diff --git a/hst/template_test.go b/hst/template_test.go
index a9b92262..8761b7d4 100644
--- a/hst/template_test.go
+++ b/hst/template_test.go
@@ -80,7 +80,7 @@ func TestTemplate(t *testing.T) {
],
"container": {
"hostname": "localhost",
- "immediate_termination": true,
+ "wait_delay": -1,
"seccomp_flags": 1,
"seccomp_presets": 1,
"seccomp_compat": true,