ComunicRTCProxy/main.go

33 lines
543 B
Go
Raw Normal View History

2020-04-09 15:32:16 +00:00
package main
import (
"fmt"
2020-04-12 15:24:49 +00:00
"log"
2020-04-10 06:46:34 +00:00
"os"
2020-04-12 15:24:49 +00:00
"time"
2020-04-09 15:32:16 +00:00
)
func main() {
2020-04-10 06:46:34 +00:00
println("Comunic RTC Proxy. (c) Pierre Hubert 2020")
// Command line args
if len(os.Args) != 2 {
fmt.Printf("Usage: %s <config>", os.Args[0])
}
// First, load the config
conf := loadConfig(os.Args[1])
2020-04-12 15:24:49 +00:00
/// Avoid to quick restart loop
defer timeBeforeQuit(&conf)
2020-04-10 07:43:14 +00:00
// Then connect to websocket
openWs(&conf)
2020-04-09 15:32:16 +00:00
}
2020-04-12 15:24:49 +00:00
func timeBeforeQuit(c *Config) {
log.Printf("Waiting %d seconds before quitting...", c.Restart)
time.Sleep(time.Second * time.Duration(c.Restart))
}