mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-04 13:32:52 -04:00
31 lines
527 B
Go
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
|
|
}
|
|
}
|