mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 08:03:40 +00:00
feat: add guest config injection and host nat wiring
This commit is contained in:
parent
28ca0219d9
commit
a12f54ba5d
8 changed files with 332 additions and 6 deletions
|
|
@ -21,6 +21,7 @@ var (
|
|||
|
||||
type RuntimeConfig struct {
|
||||
RootDir string
|
||||
EgressInterface string
|
||||
FirecrackerBinaryPath string
|
||||
JailerBinaryPath string
|
||||
}
|
||||
|
|
@ -50,6 +51,10 @@ func NewRuntime(cfg RuntimeConfig) (*Runtime, error) {
|
|||
if jailerBinaryPath == "" {
|
||||
return nil, fmt.Errorf("jailer binary path is required")
|
||||
}
|
||||
egressInterface := strings.TrimSpace(cfg.EgressInterface)
|
||||
if egressInterface == "" {
|
||||
return nil, fmt.Errorf("egress interface is required")
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(rootDir, 0o755); err != nil {
|
||||
return nil, fmt.Errorf("create runtime root dir %q: %w", rootDir, err)
|
||||
|
|
@ -65,7 +70,7 @@ func NewRuntime(cfg RuntimeConfig) (*Runtime, error) {
|
|||
firecrackerBinaryPath: firecrackerBinaryPath,
|
||||
jailerBinaryPath: jailerBinaryPath,
|
||||
networkAllocator: allocator,
|
||||
networkProvisioner: NewIPTapProvisioner(),
|
||||
networkProvisioner: NewIPTapProvisioner(defaultNetworkCIDR, egressInterface),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue