1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

51 lines
924 B
Go
Raw Normal View History

2017-05-16 13:39:59 +02:00
package main
2017-05-16 15:22:40 +02:00
import (
2017-05-19 16:16:14 +02:00
"flag"
2017-05-16 15:22:40 +02:00
"log"
2017-05-16 13:39:59 +02:00
2021-03-22 16:25:47 +01:00
"github.com/alice-lg/alice-lg/pkg/backend"
)
2017-05-18 15:23:36 +02:00
2017-05-16 13:39:59 +02:00
func main() {
2021-03-22 17:35:20 +01:00
quit := make(chan bool)
2017-05-19 16:16:14 +02:00
// Handle commandline parameters
configFilenameFlag := flag.String(
"config", "/etc/alice-lg/alice.conf",
2017-05-19 16:16:14 +02:00
"Alice looking glass configuration file",
)
flag.Parse()
2017-05-16 15:22:40 +02:00
// Load configuration
2021-03-22 16:25:47 +01:00
if err := backend.InitConfig(*configFilenameFlag); err != nil {
2017-05-19 16:16:14 +02:00
log.Fatal(err)
}
// Say hi
printBanner()
2021-03-22 17:35:20 +01:00
log.Println("Using configuration:", backend.AliceConfig.File)
2017-05-16 15:22:40 +02:00
2017-06-23 12:36:32 +02:00
// Setup local routes store
2021-03-22 17:35:20 +01:00
backend.InitStores()
2017-07-04 12:36:48 +02:00
2021-03-22 17:35:20 +01:00
// Start stores
if backend.AliceConfig.Server.EnablePrefixLookup == true {
go backend.AliceRoutesStore.Start()
2017-07-04 12:36:48 +02:00
}
2017-06-23 12:36:32 +02:00
2017-06-23 17:40:19 +02:00
// Setup local neighbours store
2021-03-22 17:35:20 +01:00
if backend.AliceConfig.Server.EnablePrefixLookup == true {
go backend.AliceNeighboursStore.Start()
2017-07-04 12:36:48 +02:00
}
2017-06-23 17:40:19 +02:00
// Start the Housekeeping
2021-03-22 17:35:20 +01:00
go backend.Housekeeping(backend.AliceConfig)
2017-05-16 15:22:40 +02:00
2021-03-22 17:35:20 +01:00
go backend.StartHTTPServer()
2017-05-18 14:44:50 +02:00
2021-03-22 17:35:20 +01:00
<-quit
2017-05-16 13:39:59 +02:00
}