internal/pkg: expose snapshot of binfmt entries

This is otherwise not externally accessible. The resulting map can be safely mutated.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-02 16:05:09 +09:00
parent 56937ac396
commit 9e824452bd
+10
View File
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"maps"
"os"
"os/exec"
"path/filepath"
@@ -122,6 +123,15 @@ func RegisterArch(arch string, e container.BinfmtEntry) {
binfmt[arch] = e
}
// Arch returns a snapshot of currently registered [KindExec] and [KindExecNet]
// binfmt entries.
func Arch() map[string]container.BinfmtEntry {
binfmtMu.RLock()
r := maps.Clone(binfmt)
binfmtMu.RUnlock()
return r
}
const (
// ExecTimeoutDefault replaces out of range [NewExec] timeout values.
ExecTimeoutDefault = 15 * time.Minute