42 lines
618 B
Go
42 lines
618 B
Go
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)
|
|
|
|
server, err := pnyx.NewServer(nil)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = server.Start(os.Args[1])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = server.AddChannel(pnyx.ChannelID(1), &pnyx.RawMode{})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = server.AddChannel(pnyx.ChannelID(2), &pnyx.RawMode{})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
<-os_sigs
|
|
err = server.Stop()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|