Files
go-i2p/main.go

38 lines
896 B
Go
Raw Normal View History

2016-01-28 10:16:26 -05:00
package main
import (
"flag"
"github.com/go-i2p/go-i2p/lib/config"
"github.com/go-i2p/go-i2p/lib/router"
2024-10-18 11:53:01 -04:00
"github.com/go-i2p/go-i2p/lib/util/logger"
"github.com/go-i2p/go-i2p/lib/util/signals"
2016-01-28 10:16:26 -05:00
)
2024-10-18 11:53:01 -04:00
var log = logger.GetLogger()
2016-01-28 10:16:26 -05:00
func main() {
2024-10-18 11:53:01 -04:00
netDbPath := flag.String("netDb", config.DefaultNetDbConfig.Path, "Path to the netDb")
flag.Parse()
config.RouterConfigProperties.NetDb.Path = *netDbPath
2017-08-27 10:48:34 -04:00
go signals.Handle()
2024-10-18 11:53:01 -04:00
log.Debug("parsing i2p router configuration")
log.Debug("using netDb in:", config.RouterConfigProperties.NetDb.Path)
log.Debug("starting up i2p router")
2016-01-29 07:22:31 -05:00
r, err := router.CreateRouter()
if err == nil {
2017-08-27 10:48:34 -04:00
signals.RegisterReloadHandler(func() {
// TODO: reload config
})
signals.RegisterInterruptHandler(func() {
// TODO: graceful shutdown
r.Stop()
})
r.Start()
2017-08-27 10:48:34 -04:00
r.Wait()
r.Close()
2016-01-29 07:22:31 -05:00
} else {
log.Errorf("failed to create i2p router: %s", err)
}
2016-01-28 10:16:26 -05:00
}