2024-04-03 18:52:04 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"git.metznet.ca/MetzNet/pnyx"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
os_sigs := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(os_sigs, syscall.SIGINT, syscall.SIGINT)
|
|
|
|
|
2024-04-06 16:38:14 -06:00
|
|
|
server, err := pnyx.NewServer(nil)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2024-04-03 18:52:04 -06:00
|
|
|
|
2024-04-06 16:38:14 -06:00
|
|
|
err = server.Start(os.Args[1])
|
2024-04-03 18:52:04 -06:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2024-04-08 11:28:52 -06:00
|
|
|
err = server.AddChannel(pnyx.ChannelID(1), &pnyx.RawMode{})
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2024-04-08 17:23:55 -06:00
|
|
|
err = server.AddChannel(pnyx.ChannelID(2), &pnyx.RawMode{})
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2024-04-03 18:52:04 -06:00
|
|
|
<-os_sigs
|
|
|
|
err = server.Stop()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|