Example #1
0
File: main.go Project: jarod/skynet
func main() {
	flag.Parse()

	if *version {
		fmt.Printf("skynet-agent - %s\n", VERSION)
		os.Exit(0)
	}

	sklog.SetLogFile(*optLogFile)

	httpServer = NewHttpServer()
	go httpServer.ListenAndServe(*optHTTPAddr)

	var err error
	matrixClient, err = DialMatrix(*optMatrixAddr)
	if err != nil {
		log.Println("MatrixClient: ", err)
		return
	}
	matrixHTTPClient = NewMatrixHTTPClient(*optMatrixURL)
	fetchAppInfos()

	tcpServer = NewTcpServer()
	go tcpServer.ListenAndServe(*optTcpAddr)

	t := time.NewTicker(time.Minute * 5)
	for _ = range t.C {
		matrixClient.Ping()
	}
}
Example #2
0
File: main.go Project: jarod/skynet
func main() {
	flag.Parse()

	if *version {
		fmt.Printf("skynet-matrix - %s\n", VERSION)
		os.Exit(0)
	}

	sklog.SetLogFile(*optLogFile)

	tcpServer = NewTcpServer()
	go tcpServer.ListenAndServe(*optTcpAddr)

	httpServer = NewHttpServer()
	httpServer.ListenAndServe(*optHttpAddr)
}