ace/servers/qemuserver/options.go
2022-09-26 06:54:32 +00:00

37 lines
768 B
Go

package qemuserver
import (
"net/url"
"os"
"syscall"
"time"
)
type Options struct {
QmpAddress string `yaml:"address"`
Timeout time.Duration `yaml:"timeout"`
Name string `yaml:"name"`
VNCAddress string `yaml:"vnc"`
AudioPipe string `yaml:"audio_pipe"`
AudioDevice string `yaml:"audio_device"`
}
func ExampleOptions() *Options {
return &Options{
QmpAddress: (&url.URL{
Scheme: "unix",
Path: "/tmp/qemu.sock",
}).String(),
Timeout: time.Duration(60 * time.Second),
Name: "ace-qemu",
VNCAddress: "localhost:5900",
AudioPipe: "/tmp/audio",
AudioDevice: "snd0",
}
}
func (o *Options) MakeFIFO() error {
os.Remove(o.AudioPipe)
return syscall.Mkfifo(o.AudioPipe, 0600)
}