Rework discovery

peer discovery happens now based on vault ids not the general token
"pentapass". It also happens periodically instead of just once
This commit is contained in:
2024-10-10 13:12:26 +02:00
parent 069fdf8215
commit a3f2a5ee6d
4 changed files with 114 additions and 64 deletions

View File

@@ -50,9 +50,6 @@ func main() {
Logger.Panic(err)
}
Logger.Info("Starting peer discovery...")
go storage.DiscoverPeers(ctx, h, dht)
Logger.Info("Initializing datastore...")
store, err := badger.NewDatastore(data, &badger.DefaultOptions)
if err != nil {
@@ -74,6 +71,9 @@ func main() {
Key: key,
}
Logger.Info("Starting peer discovery...")
go storageHandler.RunBackground(ctx, h, dht)
configPath := *dbPath + "/config.json"
Logger.Infof("Loading config from: %s", configPath)
Cfg, err := storageHandler.NewConfig(configPath)
@@ -93,6 +93,7 @@ func main() {
}
Logger.Infof("Initialization complete!")
Logger.Infof("Serving RPC for ppass cli")
rpc.StorageHandler = &storageHandler
rpc.Serve(*dbPath)
}