ace/servers/qemuserver/options.go

37 lines
768 B
Go
Raw Permalink Normal View History

2022-09-26 03:04:07 +00:00
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 {
2022-09-26 06:54:32 +00:00
os.Remove(o.AudioPipe)
return syscall.Mkfifo(o.AudioPipe, 0600)
2022-09-26 03:04:07 +00:00
}