Files
go-i2p/lib/router/router.go

31 lines
527 B
Go
Raw Normal View History

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