Files
go-i2p/lib/router/router.go
2016-01-29 07:22:31 -05:00

31 lines
527 B
Go

package router
import (
"github.com/bounce-chat/go-i2p/lib/config"
"github.com/bounce-chat/go-i2p/lib/netdb"
)
// i2p router type
type Router struct {
cfg *config.RouterConfig
ndb netdb.StdNetDB
}
func CreateRouter() (r *Router, err error) {
cfg := config.Router
r = &Router{
cfg: cfg,
ndb: netdb.StdNetDB(cfg.NetDbDir),
}
return
}
// run i2p router mainloop
func (r *Router) Run() {
// make sure the netdb is ready
err := r.ndb.Ensure(r.cfg.Bootstrap.LowPeerThreshold)
if err == nil {
// netdb ready
}
}