mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
Merge branch 'main' of gitlab.hackers.town:veilid/veilid into dht-testing
This commit is contained in:
commit
d21f580de2
@ -61,6 +61,7 @@ distribute_amd64:
|
||||
- linux
|
||||
- amd64
|
||||
script:
|
||||
- earthly +package-linux-amd64
|
||||
- /home/gitlab-runner/distribute-packages.sh
|
||||
|
||||
|
||||
|
31
Cargo.lock
generated
31
Cargo.lock
generated
@ -1502,7 +1502,7 @@ dependencies = [
|
||||
"flexi_logger",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"time 0.3.9",
|
||||
"time 0.3.22",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
@ -1544,7 +1544,7 @@ dependencies = [
|
||||
"owning_ref",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"time 0.3.9",
|
||||
"time 0.3.22",
|
||||
"tokio 1.28.2",
|
||||
"toml 0.7.4",
|
||||
"unicode-segmentation",
|
||||
@ -2055,7 +2055,7 @@ dependencies = [
|
||||
"regex",
|
||||
"rustversion",
|
||||
"thiserror",
|
||||
"time 0.3.9",
|
||||
"time 0.3.22",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5317,7 +5317,7 @@ checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369"
|
||||
dependencies = [
|
||||
"log",
|
||||
"termcolor",
|
||||
"time 0.3.9",
|
||||
"time 0.3.22",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5668,16 +5668,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.9"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd"
|
||||
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"libc",
|
||||
"num_threads",
|
||||
"time-macros 0.2.4",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros 0.2.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.1.1"
|
||||
@ -5690,9 +5698,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.4"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
|
||||
checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-macros-impl"
|
||||
@ -6004,7 +6015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"time 0.3.9",
|
||||
"time 0.3.22",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
|
@ -52,7 +52,7 @@ core:
|
||||
routing_table:
|
||||
node_id: null
|
||||
node_id_secret: null
|
||||
bootstrap: ['bootstrap.dev.veilid.net']
|
||||
bootstrap: ['bootstrap.veilid.net']
|
||||
limit_over_attached: 64
|
||||
limit_fully_attached: 32
|
||||
limit_attached_strong: 16
|
||||
|
@ -190,7 +190,7 @@ network:
|
||||
hole_punch_receipt_time_ms: 5000
|
||||
node_id: ''
|
||||
node_id_secret: ''
|
||||
bootstrap: ['bootstrap.dev.veilid.net']
|
||||
bootstrap: ['bootstrap.veilid.net']
|
||||
upnp: true
|
||||
detect_address_changes: true
|
||||
enable_local_peer_scope: false
|
||||
|
@ -346,14 +346,53 @@ impl RoutingTable {
|
||||
}
|
||||
/// Deserialize routing table from table store
|
||||
async fn load_buckets(&self) -> EyreResult<()> {
|
||||
// Make a cache validity key of all our node ids and our bootstrap choice
|
||||
let mut cache_validity_key: Vec<u8> = Vec::new();
|
||||
{
|
||||
let c = self.unlocked_inner.config.get();
|
||||
for ck in VALID_CRYPTO_KINDS {
|
||||
cache_validity_key.append(
|
||||
&mut c
|
||||
.network
|
||||
.routing_table
|
||||
.node_id
|
||||
.get(ck)
|
||||
.unwrap()
|
||||
.value
|
||||
.bytes
|
||||
.to_vec(),
|
||||
);
|
||||
}
|
||||
for b in &c.network.routing_table.bootstrap {
|
||||
cache_validity_key.append(&mut b.as_bytes().to_vec());
|
||||
}
|
||||
};
|
||||
|
||||
// Deserialize bucket map and all entries from the table store
|
||||
let tstore = self.unlocked_inner.network_manager().table_store();
|
||||
let tdb = tstore.open("routing_table", 1).await?;
|
||||
let Some(serialized_bucket_map): Option<SerializedBucketMap> = tdb.load_rkyv(0, b"serialized_bucket_map").await? else {
|
||||
let table_store = self.unlocked_inner.network_manager().table_store();
|
||||
let db = table_store.open("routing_table", 1).await?;
|
||||
|
||||
let caches_valid = match db.load(0, b"cache_validity_key").await? {
|
||||
Some(v) => v == cache_validity_key,
|
||||
None => false,
|
||||
};
|
||||
if !caches_valid {
|
||||
// Caches not valid, start over
|
||||
log_rtab!(debug "cache validity key changed, emptying routing table");
|
||||
drop(db);
|
||||
table_store.delete("routing_table").await?;
|
||||
let db = table_store.open("routing_table", 1).await?;
|
||||
db.store(0, b"cache_validity_key", &cache_validity_key)
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Caches valid, load saved routing table
|
||||
let Some(serialized_bucket_map): Option<SerializedBucketMap> = db.load_rkyv(0, b"serialized_bucket_map").await? else {
|
||||
log_rtab!(debug "no bucket map in saved routing table");
|
||||
return Ok(());
|
||||
};
|
||||
let Some(all_entry_bytes): Option<SerializedBuckets> = tdb.load_rkyv(0, b"all_entry_bytes").await? else {
|
||||
let Some(all_entry_bytes): Option<SerializedBuckets> = db.load_rkyv(0, b"all_entry_bytes").await? else {
|
||||
log_rtab!(debug "no all_entry_bytes in saved routing table");
|
||||
return Ok(());
|
||||
};
|
||||
|
@ -97,8 +97,8 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
nodeId: [],
|
||||
nodeIdSecret: [],
|
||||
bootstrap: kIsWeb
|
||||
? ["ws://bootstrap.dev.veilid.net:5150/ws"]
|
||||
: ["bootstrap.dev.veilid.net"],
|
||||
? ["ws://bootstrap.veilid.net:5150/ws"]
|
||||
: ["bootstrap.veilid.net"],
|
||||
limitOverAttached: 64,
|
||||
limitFullyAttached: 32,
|
||||
limitAttachedStrong: 16,
|
||||
|
@ -72,7 +72,7 @@ core:
|
||||
routing_table:
|
||||
node_id: null
|
||||
node_id_secret: null
|
||||
bootstrap: ['bootstrap.dev.veilid.net']
|
||||
bootstrap: ['bootstrap.veilid.net']
|
||||
limit_over_attached: 64
|
||||
limit_fully_attached: 32
|
||||
limit_attached_strong: 16
|
||||
|
Loading…
Reference in New Issue
Block a user