mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-12-11 22:20:25 -05:00
immutable config
move node id and public key init to routing table
This commit is contained in:
parent
bad7f3b89e
commit
8b5f77f264
39 changed files with 313 additions and 574 deletions
|
|
@ -12,7 +12,12 @@ async fn main() {
|
||||||
}
|
}
|
||||||
Network(msg) => {
|
Network(msg) => {
|
||||||
println!(
|
println!(
|
||||||
"Network: Peers {:}, bytes/sec [{} up] [{} down]",
|
"Network: Node Ids: {}, Peers {}, bytes/sec [{} up] [{} down]",
|
||||||
|
if msg.node_ids.is_empty() {
|
||||||
|
"(none assigned)".to_string()
|
||||||
|
} else {
|
||||||
|
msg.node_ids.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")
|
||||||
|
},
|
||||||
msg.peers.len(),
|
msg.peers.len(),
|
||||||
msg.bps_up,
|
msg.bps_up,
|
||||||
msg.bps_down
|
msg.bps_down
|
||||||
|
|
@ -58,21 +63,12 @@ async fn main() {
|
||||||
let veilid = veilid_core::api_startup(update_callback, config)
|
let veilid = veilid_core::api_startup(update_callback, config)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!(
|
|
||||||
"Node ID: {}",
|
|
||||||
veilid
|
|
||||||
.config()
|
|
||||||
.unwrap()
|
|
||||||
.config()
|
|
||||||
.network
|
|
||||||
.routing_table
|
|
||||||
.public_keys
|
|
||||||
);
|
|
||||||
|
|
||||||
// Attach to the network
|
// Attach to the network
|
||||||
veilid.attach().await.unwrap();
|
veilid.attach().await.unwrap();
|
||||||
|
|
||||||
// Until CTRL+C is pressed, keep running
|
// Until CTRL+C is pressed, keep running
|
||||||
tokio::signal::ctrl_c().await.unwrap();
|
tokio::signal::ctrl_c().await.unwrap();
|
||||||
|
|
||||||
veilid.shutdown().await;
|
veilid.shutdown().await;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,15 @@ impl VeilidCoreContext {
|
||||||
config: VeilidConfig,
|
config: VeilidConfig,
|
||||||
) -> VeilidAPIResult<VeilidCoreContext> {
|
) -> VeilidAPIResult<VeilidCoreContext> {
|
||||||
// Set up config from json
|
// Set up config from json
|
||||||
let config = VeilidStartupOptions::new_from_config(config, update_callback);
|
let config = VeilidStartupOptions::try_new(config, update_callback)?;
|
||||||
|
|
||||||
Self::new_common(config).await
|
Self::new_common(config).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "trace", target = "core_context", err, skip_all)]
|
#[instrument(level = "trace", target = "core_context", err, skip_all)]
|
||||||
async fn new_common(startup_options: VeilidStartupOptions) -> VeilidAPIResult<VeilidCoreContext> {
|
async fn new_common(
|
||||||
|
startup_options: VeilidStartupOptions,
|
||||||
|
) -> VeilidAPIResult<VeilidCoreContext> {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(target_os = "android")] {
|
if #[cfg(target_os = "android")] {
|
||||||
if !crate::intf::android::is_android_ready() {
|
if !crate::intf::android::is_android_ready() {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ impl Crypto {
|
||||||
// Setup called by table store after it get initialized
|
// Setup called by table store after it get initialized
|
||||||
#[instrument(level = "trace", target = "crypto", skip_all, err)]
|
#[instrument(level = "trace", target = "crypto", skip_all, err)]
|
||||||
pub(crate) async fn table_store_setup(&self, table_store: &TableStore) -> EyreResult<()> {
|
pub(crate) async fn table_store_setup(&self, table_store: &TableStore) -> EyreResult<()> {
|
||||||
|
|
||||||
// load caches if they are valid for this node id
|
// load caches if they are valid for this node id
|
||||||
let caches_valid = {
|
let caches_valid = {
|
||||||
let db = table_store
|
let db = table_store
|
||||||
|
|
@ -357,5 +356,4 @@ impl Crypto {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@ impl AddressFilter {
|
||||||
max_connections_per_ip6_prefix: config.network.max_connections_per_ip6_prefix as usize,
|
max_connections_per_ip6_prefix: config.network.max_connections_per_ip6_prefix as usize,
|
||||||
max_connections_per_ip6_prefix_size: config.network.max_connections_per_ip6_prefix_size
|
max_connections_per_ip6_prefix_size: config.network.max_connections_per_ip6_prefix_size
|
||||||
as usize,
|
as usize,
|
||||||
max_connection_frequency_per_min: config.network.max_connection_frequency_per_min as usize,
|
max_connection_frequency_per_min: config.network.max_connection_frequency_per_min
|
||||||
|
as usize,
|
||||||
punishment_duration_min: PUNISHMENT_DURATION_MIN,
|
punishment_duration_min: PUNISHMENT_DURATION_MIN,
|
||||||
dial_info_failure_duration_min: DIAL_INFO_FAILURE_DURATION_MIN,
|
dial_info_failure_duration_min: DIAL_INFO_FAILURE_DURATION_MIN,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,13 @@ impl NetworkManager {
|
||||||
/// If no bootstrap keys are specified, uses the v0 mechanism, otherwise uses the v1 mechanism
|
/// If no bootstrap keys are specified, uses the v0 mechanism, otherwise uses the v1 mechanism
|
||||||
#[instrument(level = "trace", target = "net", err, skip(self))]
|
#[instrument(level = "trace", target = "net", err, skip(self))]
|
||||||
pub async fn direct_bootstrap(&self, dial_info: DialInfo) -> EyreResult<Vec<Arc<PeerInfo>>> {
|
pub async fn direct_bootstrap(&self, dial_info: DialInfo) -> EyreResult<Vec<Arc<PeerInfo>>> {
|
||||||
let direct_boot_version = if self.config().network.routing_table.bootstrap_keys.is_empty() {
|
let direct_boot_version = if self
|
||||||
|
.config()
|
||||||
|
.network
|
||||||
|
.routing_table
|
||||||
|
.bootstrap_keys
|
||||||
|
.is_empty()
|
||||||
|
{
|
||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
1
|
1
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,13 @@ impl NetworkManager {
|
||||||
// Get the minimum bootstrap version we are supporting
|
// Get the minimum bootstrap version we are supporting
|
||||||
// If no keys are available, allow v0.
|
// If no keys are available, allow v0.
|
||||||
// If bootstrap keys are specified, require at least v1.
|
// If bootstrap keys are specified, require at least v1.
|
||||||
let min_boot_version = if self.config().network.routing_table.bootstrap_keys.is_empty() {
|
let min_boot_version = if self
|
||||||
|
.config()
|
||||||
|
.network
|
||||||
|
.routing_table
|
||||||
|
.bootstrap_keys
|
||||||
|
.is_empty()
|
||||||
|
{
|
||||||
BOOTSTRAP_TXT_VERSION_0
|
BOOTSTRAP_TXT_VERSION_0
|
||||||
} else {
|
} else {
|
||||||
BOOTSTRAP_TXT_VERSION_1
|
BOOTSTRAP_TXT_VERSION_1
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ impl ConnectionTable {
|
||||||
pub fn new(registry: VeilidComponentRegistry) -> Self {
|
pub fn new(registry: VeilidComponentRegistry) -> Self {
|
||||||
let config = registry.config();
|
let config = registry.config();
|
||||||
let max_connections = {
|
let max_connections = {
|
||||||
|
|
||||||
let mut max_connections = BTreeMap::<ProtocolType, usize>::new();
|
let mut max_connections = BTreeMap::<ProtocolType, usize>::new();
|
||||||
|
|
||||||
max_connections.insert(
|
max_connections.insert(
|
||||||
|
|
|
||||||
|
|
@ -1092,12 +1092,14 @@ impl NetworkManager {
|
||||||
|
|
||||||
// Get timestamp range
|
// Get timestamp range
|
||||||
let config = self.config();
|
let config = self.config();
|
||||||
let tsbehind =config.network
|
let tsbehind = config
|
||||||
|
.network
|
||||||
.rpc
|
.rpc
|
||||||
.max_timestamp_behind_ms
|
.max_timestamp_behind_ms
|
||||||
.map(ms_to_us)
|
.map(ms_to_us)
|
||||||
.map(TimestampDuration::new);
|
.map(TimestampDuration::new);
|
||||||
let tsahead = config.network
|
let tsahead = config
|
||||||
|
.network
|
||||||
.rpc
|
.rpc
|
||||||
.max_timestamp_ahead_ms
|
.max_timestamp_ahead_ms
|
||||||
.map(ms_to_us)
|
.map(ms_to_us)
|
||||||
|
|
@ -1170,8 +1172,7 @@ impl NetworkManager {
|
||||||
// which only performs a lightweight lookup before passing the packet back out
|
// which only performs a lightweight lookup before passing the packet back out
|
||||||
|
|
||||||
// If our node has the relay capability disabled, we should not be asked to relay
|
// If our node has the relay capability disabled, we should not be asked to relay
|
||||||
if self.config().capabilities.disable.contains(&CAP_RELAY)
|
if self.config().capabilities.disable.contains(&CAP_RELAY) {
|
||||||
{
|
|
||||||
veilid_log!(self debug "node has relay capability disabled, dropping relayed envelope from {} to {}", sender_id, recipient_id);
|
veilid_log!(self debug "node has relay capability disabled, dropping relayed envelope from {} to {}", sender_id, recipient_id);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,10 @@ impl WebsocketProtocolHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
format!("GET /{}", config.network.protocol.ws.path.trim_end_matches('/'))
|
format!(
|
||||||
|
"GET /{}",
|
||||||
|
config.network.protocol.ws.path.trim_end_matches('/')
|
||||||
|
)
|
||||||
};
|
};
|
||||||
let connection_initial_timeout_ms = if tls {
|
let connection_initial_timeout_ms = if tls {
|
||||||
config.network.tls.connection_initial_timeout_ms
|
config.network.tls.connection_initial_timeout_ms
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,10 @@ impl Network {
|
||||||
|
|
||||||
let (upnp, require_inbound_relay) = {
|
let (upnp, require_inbound_relay) = {
|
||||||
let config = self.config();
|
let config = self.config();
|
||||||
(config.network.upnp, config.network.privacy.require_inbound_relay)
|
(
|
||||||
|
config.network.upnp,
|
||||||
|
config.network.privacy.require_inbound_relay,
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
if require_inbound_relay {
|
if require_inbound_relay {
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,8 @@ impl NetworkManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
let config = self.config();
|
let config = self.config();
|
||||||
let excessive_reverse_connect_duration_us = (config.network.connection_initial_timeout_ms * 2
|
let excessive_reverse_connect_duration_us =
|
||||||
|
(config.network.connection_initial_timeout_ms * 2
|
||||||
+ config.network.reverse_connection_receipt_time_ms) as u64
|
+ config.network.reverse_connection_receipt_time_ms) as u64
|
||||||
* 1000;
|
* 1000;
|
||||||
|
|
||||||
|
|
@ -447,7 +448,8 @@ impl NetworkManager {
|
||||||
data
|
data
|
||||||
};
|
};
|
||||||
|
|
||||||
let hole_punch_receipt_time_us = self.config().network.hole_punch_receipt_time_ms as u64 * 1000;
|
let hole_punch_receipt_time_us =
|
||||||
|
self.config().network.hole_punch_receipt_time_ms as u64 * 1000;
|
||||||
|
|
||||||
let unique_flow = network_result_try!(
|
let unique_flow = network_result_try!(
|
||||||
pin_future!(debug_duration(
|
pin_future!(debug_duration(
|
||||||
|
|
@ -808,7 +810,9 @@ impl NetworkManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build a return receipt for the signal
|
// Build a return receipt for the signal
|
||||||
let receipt_timeout = TimestampDuration::new_ms(self.config().network.reverse_connection_receipt_time_ms as u64);
|
let receipt_timeout = TimestampDuration::new_ms(
|
||||||
|
self.config().network.reverse_connection_receipt_time_ms as u64,
|
||||||
|
);
|
||||||
let (receipt, eventual_value) = self.generate_single_shot_receipt(receipt_timeout, [])?;
|
let (receipt, eventual_value) = self.generate_single_shot_receipt(receipt_timeout, [])?;
|
||||||
|
|
||||||
// Get target routing domain
|
// Get target routing domain
|
||||||
|
|
@ -920,7 +924,8 @@ impl NetworkManager {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Build a return receipt for the signal
|
// Build a return receipt for the signal
|
||||||
let receipt_timeout = TimestampDuration::new_ms(self.config().network.hole_punch_receipt_time_ms as u64);
|
let receipt_timeout =
|
||||||
|
TimestampDuration::new_ms(self.config().network.hole_punch_receipt_time_ms as u64);
|
||||||
let (receipt, eventual_value) = self.generate_single_shot_receipt(receipt_timeout, [])?;
|
let (receipt, eventual_value) = self.generate_single_shot_receipt(receipt_timeout, [])?;
|
||||||
|
|
||||||
// Get target routing domain
|
// Get target routing domain
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ impl NetworkManager {
|
||||||
bps_down: 0.into(),
|
bps_down: 0.into(),
|
||||||
bps_up: 0.into(),
|
bps_up: 0.into(),
|
||||||
peers: Vec::new(),
|
peers: Vec::new(),
|
||||||
|
node_ids: Vec::new(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let routing_table = self.routing_table();
|
let routing_table = self.routing_table();
|
||||||
|
|
@ -136,6 +137,7 @@ impl NetworkManager {
|
||||||
}
|
}
|
||||||
out
|
out
|
||||||
},
|
},
|
||||||
|
node_ids: routing_table.node_ids().to_vec(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,17 +253,8 @@ impl RoutingTable {
|
||||||
async fn init_async(&self) -> EyreResult<()> {
|
async fn init_async(&self) -> EyreResult<()> {
|
||||||
veilid_log!(self debug "starting routing table init");
|
veilid_log!(self debug "starting routing table init");
|
||||||
|
|
||||||
// Set up node ids
|
// Set up initial keys and node ids
|
||||||
{
|
self.setup_public_keys().await?;
|
||||||
let mut node_ids = NodeIdGroup::new();
|
|
||||||
for pk in self.public_keys().iter() {
|
|
||||||
let node_id = self
|
|
||||||
.generate_node_id(pk)
|
|
||||||
.wrap_err("unable to generate node id for public key")?;
|
|
||||||
node_ids.add(node_id);
|
|
||||||
}
|
|
||||||
*self.node_ids.write() = node_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up routing buckets
|
// Set up routing buckets
|
||||||
{
|
{
|
||||||
|
|
@ -433,9 +424,9 @@ impl RoutingTable {
|
||||||
async fn setup_public_key(
|
async fn setup_public_key(
|
||||||
&self,
|
&self,
|
||||||
vcrypto: AsyncCryptoSystemGuard<'_>,
|
vcrypto: AsyncCryptoSystemGuard<'_>,
|
||||||
table_store: &TableStore,
|
|
||||||
) -> VeilidAPIResult<(PublicKey, SecretKey)> {
|
) -> VeilidAPIResult<(PublicKey, SecretKey)> {
|
||||||
let config = self.config();
|
let config = self.config();
|
||||||
|
let table_store = self.table_store();
|
||||||
let ck = vcrypto.kind();
|
let ck = vcrypto.kind();
|
||||||
let mut public_key = config.network.routing_table.public_keys.get(ck);
|
let mut public_key = config.network.routing_table.public_keys.get(ck);
|
||||||
let mut secret_key = config.network.routing_table.secret_keys.get(ck);
|
let mut secret_key = config.network.routing_table.secret_keys.get(ck);
|
||||||
|
|
@ -501,7 +492,7 @@ impl RoutingTable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a node id from storage, check it
|
// If we have a public key from storage, check it
|
||||||
let (public_key, secret_key) =
|
let (public_key, secret_key) =
|
||||||
if let (Some(public_key), Some(secret_key)) = (public_key, secret_key) {
|
if let (Some(public_key), Some(secret_key)) = (public_key, secret_key) {
|
||||||
// Validate node id
|
// Validate node id
|
||||||
|
|
@ -518,9 +509,7 @@ impl RoutingTable {
|
||||||
vcrypto.generate_keypair().await.into_split()
|
vcrypto.generate_keypair().await.into_split()
|
||||||
};
|
};
|
||||||
|
|
||||||
veilid_log!(self info "Public Key: {}", public_key);
|
// Save the public key + secret in storage
|
||||||
|
|
||||||
// Save the node id / secret in storage
|
|
||||||
config_table
|
config_table
|
||||||
.store_json(0, table_key_public_key.as_bytes(), &public_key)
|
.store_json(0, table_key_public_key.as_bytes(), &public_key)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
@ -533,7 +522,7 @@ impl RoutingTable {
|
||||||
|
|
||||||
/// Get the public keys from config if one is specified
|
/// Get the public keys from config if one is specified
|
||||||
#[cfg_attr(test, allow(unused_variables))]
|
#[cfg_attr(test, allow(unused_variables))]
|
||||||
async fn setup_public_keys(&self, table_store: &TableStore) -> VeilidAPIResult<()> {
|
async fn setup_public_keys(&self) -> VeilidAPIResult<()> {
|
||||||
let crypto = self.crypto();
|
let crypto = self.crypto();
|
||||||
|
|
||||||
let mut out_public_keys = PublicKeyGroup::new();
|
let mut out_public_keys = PublicKeyGroup::new();
|
||||||
|
|
@ -547,15 +536,29 @@ impl RoutingTable {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
let (public_key, secret_key) = vcrypto.generate_keypair().await.into_split();
|
let (public_key, secret_key) = vcrypto.generate_keypair().await.into_split();
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
let (public_key, secret_key) = self.setup_public_key(vcrypto, table_store).await?;
|
let (public_key, secret_key) = self.setup_public_key(vcrypto).await?;
|
||||||
|
|
||||||
// Save for config
|
// Save for config
|
||||||
out_public_keys.add(public_key);
|
out_public_keys.add(public_key);
|
||||||
out_secret_keys.add(secret_key);
|
out_secret_keys.add(secret_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
*(self.public_keys.write()) = out_public_keys;
|
veilid_log!(self info "Public Keys: {}", out_public_keys);
|
||||||
*(self.secret_keys.write()) = out_secret_keys;
|
|
||||||
|
*self.public_keys.write() = out_public_keys;
|
||||||
|
*self.secret_keys.write() = out_secret_keys;
|
||||||
|
|
||||||
|
// Set up node ids
|
||||||
|
let mut node_ids = NodeIdGroup::new();
|
||||||
|
for pk in self.public_keys().iter() {
|
||||||
|
let node_id = self
|
||||||
|
.generate_node_id(pk)?;
|
||||||
|
node_ids.add(node_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
veilid_log!(self info "Node Ids: {}", node_ids);
|
||||||
|
|
||||||
|
*self.node_ids.write() = node_ids;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -688,7 +691,8 @@ impl RoutingTable {
|
||||||
cache_validity_key.extend_from_slice(b.as_bytes());
|
cache_validity_key.extend_from_slice(b.as_bytes());
|
||||||
}
|
}
|
||||||
cache_validity_key.extend_from_slice(
|
cache_validity_key.extend_from_slice(
|
||||||
config.network
|
config
|
||||||
|
.network
|
||||||
.network_key_password
|
.network_key_password
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ pub mod mock_registry {
|
||||||
|
|
||||||
pub async fn init<S: AsRef<str>>(namespace: S) -> VeilidComponentRegistry {
|
pub async fn init<S: AsRef<str>>(namespace: S) -> VeilidComponentRegistry {
|
||||||
let (update_callback, config) = setup_veilid_core_with_namespace(namespace);
|
let (update_callback, config) = setup_veilid_core_with_namespace(namespace);
|
||||||
let startup_options = VeilidStartupOptions::new_from_config(config, update_callback);
|
let startup_options = VeilidStartupOptions::try_new(config, update_callback).unwrap();
|
||||||
let registry = VeilidComponentRegistry::new(startup_options);
|
let registry = VeilidComponentRegistry::new(startup_options);
|
||||||
registry.enable_mock();
|
registry.enable_mock();
|
||||||
registry.register(ProtectedStore::new);
|
registry.register(ProtectedStore::new);
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,8 @@ impl RPCProcessor {
|
||||||
let node_count = config.network.dht.max_find_node_count as usize;
|
let node_count = config.network.dht.max_find_node_count as usize;
|
||||||
let _consensus_count = config.network.dht.resolve_node_count as usize;
|
let _consensus_count = config.network.dht.resolve_node_count as usize;
|
||||||
let fanout = config.network.dht.resolve_node_fanout as usize;
|
let fanout = config.network.dht.resolve_node_fanout as usize;
|
||||||
let timeout = TimestampDuration::from(ms_to_us(config.network.dht.resolve_node_timeout_ms));
|
let timeout =
|
||||||
|
TimestampDuration::from(ms_to_us(config.network.dht.resolve_node_timeout_ms));
|
||||||
|
|
||||||
// Search routing domains for peer
|
// Search routing domains for peer
|
||||||
// xxx: Eventually add other routing domains here
|
// xxx: Eventually add other routing domains here
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ impl RPCProcessor {
|
||||||
|
|
||||||
let network_manager = self.network_manager();
|
let network_manager = self.network_manager();
|
||||||
|
|
||||||
let validate_dial_info_receipt_time_ms = self.config().network.dht.validate_dial_info_receipt_time_ms as u64;
|
let validate_dial_info_receipt_time_ms =
|
||||||
|
self.config().network.dht.validate_dial_info_receipt_time_ms as u64;
|
||||||
|
|
||||||
let receipt_time = TimestampDuration::new_ms(validate_dial_info_receipt_time_ms);
|
let receipt_time = TimestampDuration::new_ms(validate_dial_info_receipt_time_ms);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,7 @@ impl StorageManager {
|
||||||
|
|
||||||
// Get the DHT parameters for 'InspectValue'
|
// Get the DHT parameters for 'InspectValue'
|
||||||
// Can use either 'get scope' or 'set scope' depending on the purpose of the inspection
|
// Can use either 'get scope' or 'set scope' depending on the purpose of the inspection
|
||||||
let (key_count, consensus_count, fanout, timeout_us) =
|
let (key_count, consensus_count, fanout, timeout_us) = if use_set_scope {
|
||||||
if use_set_scope {
|
|
||||||
let config = self.config();
|
let config = self.config();
|
||||||
(
|
(
|
||||||
config.network.dht.max_find_node_count as usize,
|
config.network.dht.max_find_node_count as usize,
|
||||||
|
|
|
||||||
|
|
@ -1248,7 +1248,8 @@ impl StorageManager {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
// Get the minimum expiration timestamp we will accept
|
// Get the minimum expiration timestamp we will accept
|
||||||
let rpc_timeout_us = TimestampDuration::from(ms_to_us(self.config().network.rpc.timeout_ms));
|
let rpc_timeout_us =
|
||||||
|
TimestampDuration::from(ms_to_us(self.config().network.rpc.timeout_ms));
|
||||||
let cur_ts = get_timestamp();
|
let cur_ts = get_timestamp();
|
||||||
let min_expiration_ts = Timestamp::new(cur_ts + rpc_timeout_us.as_u64());
|
let min_expiration_ts = Timestamp::new(cur_ts + rpc_timeout_us.as_u64());
|
||||||
let expiration_ts = if expiration.as_u64() == 0 {
|
let expiration_ts = if expiration.as_u64() == 0 {
|
||||||
|
|
@ -1563,8 +1564,7 @@ impl StorageManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FanoutResultKind::Exhausted => {
|
FanoutResultKind::Exhausted => {
|
||||||
let get_consensus = self
|
let get_consensus = self.config().network.dht.get_value_count as usize;
|
||||||
.config().network.dht.get_value_count as usize;
|
|
||||||
let value_node_count = fanout_result.consensus_nodes.len();
|
let value_node_count = fanout_result.consensus_nodes.len();
|
||||||
if value_node_count < get_consensus {
|
if value_node_count < get_consensus {
|
||||||
veilid_log!(self debug "exhausted with insufficient consensus ({}<{}), adding offline subkey: {}:{}",
|
veilid_log!(self debug "exhausted with insufficient consensus ({}<{}), adding offline subkey: {}:{}",
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ pub struct TableStore {
|
||||||
registry: VeilidComponentRegistry,
|
registry: VeilidComponentRegistry,
|
||||||
inner: Mutex<TableStoreInner>, // Sync mutex here because TableDB drops can happen at any time
|
inner: Mutex<TableStoreInner>, // Sync mutex here because TableDB drops can happen at any time
|
||||||
table_store_driver: TableStoreDriver,
|
table_store_driver: TableStoreDriver,
|
||||||
async_lock: Arc<AsyncMutex<()>>, // Async mutex for operations
|
async_lock: Arc<AsyncMutex<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for TableStore {
|
impl fmt::Debug for TableStore {
|
||||||
|
|
@ -373,7 +373,11 @@ impl TableStore {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get device encryption key protection password if we have it
|
// Get device encryption key protection password if we have it
|
||||||
let device_encryption_key_password = self.config().protected_store.device_encryption_key_password.clone();
|
let device_encryption_key_password = self
|
||||||
|
.config()
|
||||||
|
.protected_store
|
||||||
|
.device_encryption_key_password
|
||||||
|
.clone();
|
||||||
|
|
||||||
Ok(Some(
|
Ok(Some(
|
||||||
self.maybe_unprotect_device_encryption_key(&dek_bytes, &device_encryption_key_password)
|
self.maybe_unprotect_device_encryption_key(&dek_bytes, &device_encryption_key_password)
|
||||||
|
|
@ -396,23 +400,23 @@ impl TableStore {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get new device encryption key protection password if we are changing it
|
// Get new device encryption key protection password if we are changing it
|
||||||
let new_device_encryption_key_password = self.config().protected_store.new_device_encryption_key_password.clone();
|
let new_device_encryption_key_password = self
|
||||||
|
.config()
|
||||||
|
.protected_store
|
||||||
|
.new_device_encryption_key_password
|
||||||
|
.clone();
|
||||||
let device_encryption_key_password =
|
let device_encryption_key_password =
|
||||||
if let Some(new_device_encryption_key_password) = new_device_encryption_key_password {
|
if let Some(new_device_encryption_key_password) = new_device_encryption_key_password {
|
||||||
// Change password
|
// Change password
|
||||||
veilid_log!(self debug "changing dek password");
|
veilid_log!(self debug "changing dek password");
|
||||||
self.config()
|
new_device_encryption_key_password
|
||||||
.try_with_mut(|c| {
|
|
||||||
c.protected_store
|
|
||||||
.device_encryption_key_password
|
|
||||||
.clone_from(&new_device_encryption_key_password);
|
|
||||||
Ok(new_device_encryption_key_password)
|
|
||||||
})
|
|
||||||
.unwrap()
|
|
||||||
} else {
|
} else {
|
||||||
// Get device encryption key protection password if we have it
|
// Get device encryption key protection password if we have it
|
||||||
veilid_log!(self debug "saving with existing dek password");
|
veilid_log!(self debug "saving with existing dek password");
|
||||||
self.config().protected_store.device_encryption_key_password.clone()
|
self.config()
|
||||||
|
.protected_store
|
||||||
|
.device_encryption_key_password
|
||||||
|
.clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
let dek_bytes = self
|
let dek_bytes = self
|
||||||
|
|
@ -456,7 +460,11 @@ impl TableStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for password change
|
// Check for password change
|
||||||
let changing_password = self.config().protected_store.new_device_encryption_key_password.is_some();
|
let changing_password = self
|
||||||
|
.config()
|
||||||
|
.protected_store
|
||||||
|
.new_device_encryption_key_password
|
||||||
|
.is_some();
|
||||||
|
|
||||||
// Save encryption key if it has changed or if the protecting password wants to change
|
// Save encryption key if it has changed or if the protecting password wants to change
|
||||||
if device_encryption_key_changed || changing_password {
|
if device_encryption_key_changed || changing_password {
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ pub fn fix_fake_veilid_config() -> VeilidConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_startup_options() -> VeilidStartupOptions {
|
pub fn get_startup_options() -> VeilidStartupOptions {
|
||||||
VeilidStartupOptions::new_from_config(get_config(), Arc::new(update_callback))
|
VeilidStartupOptions::try_new(get_config(), Arc::new(update_callback)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_config() -> VeilidConfig {
|
pub fn get_config() -> VeilidConfig {
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ impl VeilidAPI {
|
||||||
network,
|
network,
|
||||||
config: Box::new(VeilidStateConfig {
|
config: Box::new(VeilidStateConfig {
|
||||||
config: config.as_ref().clone(),
|
config: config.as_ref().clone(),
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +280,8 @@ impl VeilidAPI {
|
||||||
Crypto::validate_crypto_kind(*kind)?;
|
Crypto::validate_crypto_kind(*kind)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let default_route_hop_count: usize = self.config()?.network.rpc.default_route_hop_count.into();
|
let default_route_hop_count: usize =
|
||||||
|
self.config()?.network.rpc.default_route_hop_count.into();
|
||||||
|
|
||||||
let safety_spec = SafetySpec {
|
let safety_spec = SafetySpec {
|
||||||
preferred_route: None,
|
preferred_route: None,
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,8 @@ fn get_safety_selection(
|
||||||
registry: VeilidComponentRegistry,
|
registry: VeilidComponentRegistry,
|
||||||
) -> impl Fn(&str) -> Option<SafetySelection> {
|
) -> impl Fn(&str) -> Option<SafetySelection> {
|
||||||
move |text| {
|
move |text| {
|
||||||
let default_route_hop_count = registry.config().network.rpc.default_route_hop_count as usize;
|
let default_route_hop_count =
|
||||||
|
registry.config().network.rpc.default_route_hop_count as usize;
|
||||||
|
|
||||||
if !text.is_empty() && &text[0..1] == "-" {
|
if !text.is_empty() && &text[0..1] == "-" {
|
||||||
// Unsafe
|
// Unsafe
|
||||||
|
|
@ -825,6 +826,7 @@ impl VeilidAPI {
|
||||||
Ok(nodeid)
|
Ok(nodeid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[expect(clippy::unused_async)]
|
||||||
async fn debug_config(&self, args: String) -> VeilidAPIResult<String> {
|
async fn debug_config(&self, args: String) -> VeilidAPIResult<String> {
|
||||||
let mut args = args.as_str();
|
let mut args = args.as_str();
|
||||||
let mut config = self.config()?;
|
let mut config = self.config()?;
|
||||||
|
|
@ -842,25 +844,11 @@ impl VeilidAPI {
|
||||||
let rest = rest.trim_start().to_owned();
|
let rest = rest.trim_start().to_owned();
|
||||||
|
|
||||||
// One argument is 'config get'
|
// One argument is 'config get'
|
||||||
if rest.is_empty() {
|
if !rest.is_empty() {
|
||||||
return config.get_key_json(arg, true);
|
apibail_internal!("too many arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok("xxx: Can not change config".to_owned())
|
config.get_key_json(arg, true)
|
||||||
|
|
||||||
// More than one argument is 'config set'
|
|
||||||
|
|
||||||
// // Must be detached
|
|
||||||
// if !matches!(
|
|
||||||
// self.get_state().await?.attachment.state,
|
|
||||||
// AttachmentState::Detached
|
|
||||||
// ) {
|
|
||||||
// apibail_internal!("Must be detached to change config");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Change the config key
|
|
||||||
// //self.with_edit_config(|c| c.set_key_json(arg, &rest))?;
|
|
||||||
// Ok("Config value set".to_owned())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn debug_network(&self, args: String) -> VeilidAPIResult<String> {
|
async fn debug_network(&self, args: String) -> VeilidAPIResult<String> {
|
||||||
|
|
@ -2046,9 +2034,8 @@ impl VeilidAPI {
|
||||||
.add_rehydration_request(
|
.add_rehydration_request(
|
||||||
key.opaque(),
|
key.opaque(),
|
||||||
subkeys.unwrap_or_default(),
|
subkeys.unwrap_or_default(),
|
||||||
consensus_count.unwrap_or_else(||
|
consensus_count
|
||||||
registry.config().network.dht.set_value_count as usize
|
.unwrap_or_else(|| registry.config().network.dht.set_value_count as usize),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,7 @@ pub fn test_veilidstatenetwork() {
|
||||||
bps_down: ByteCount::from(14_400),
|
bps_down: ByteCount::from(14_400),
|
||||||
bps_up: ByteCount::from(1200),
|
bps_up: ByteCount::from(1200),
|
||||||
peers: vec![fix_peertabledata()],
|
peers: vec![fix_peertabledata()],
|
||||||
|
node_ids: vec![fix_fake_node_id()],
|
||||||
};
|
};
|
||||||
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
let copy = deserialize_json(&serialize_json(&orig)).unwrap();
|
||||||
|
|
||||||
|
|
@ -289,6 +290,7 @@ pub fn test_veilidstate() {
|
||||||
bps_down: ByteCount::from(14_400),
|
bps_down: ByteCount::from(14_400),
|
||||||
bps_up: ByteCount::from(1200),
|
bps_up: ByteCount::from(1200),
|
||||||
peers: vec![fix_peertabledata()],
|
peers: vec![fix_peertabledata()],
|
||||||
|
node_ids: vec![fix_fake_node_id()],
|
||||||
}),
|
}),
|
||||||
config: Box::new(VeilidStateConfig {
|
config: Box::new(VeilidStateConfig {
|
||||||
config: fix_fake_veilid_config(),
|
config: fix_fake_veilid_config(),
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,13 @@ pub struct VeilidStateNetwork {
|
||||||
/// The list of most recently accessed peers.
|
/// The list of most recently accessed peers.
|
||||||
/// This is not an active connection table, nor is representative of the entire routing table.
|
/// This is not an active connection table, nor is representative of the entire routing table.
|
||||||
pub peers: Vec<PeerTableData>,
|
pub peers: Vec<PeerTableData>,
|
||||||
|
/// The list of node ids for this node
|
||||||
|
#[schemars(with = "Vec<String>")]
|
||||||
|
#[cfg_attr(
|
||||||
|
all(target_arch = "wasm32", target_os = "unknown"),
|
||||||
|
tsify(type = "string[]")
|
||||||
|
)]
|
||||||
|
pub node_ids: Vec<NodeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describe a private route change that has happened
|
/// Describe a private route change that has happened
|
||||||
|
|
|
||||||
|
|
@ -955,6 +955,7 @@ impl VeilidConfig {
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn safe(&self) -> Arc<VeilidConfig> {
|
pub fn safe(&self) -> Arc<VeilidConfig> {
|
||||||
let mut safe_cfg = self.clone();
|
let mut safe_cfg = self.clone();
|
||||||
|
|
||||||
|
|
@ -967,7 +968,6 @@ impl VeilidConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_key_json(&self, key: &str, pretty: bool) -> VeilidAPIResult<String> {
|
pub fn get_key_json(&self, key: &str, pretty: bool) -> VeilidAPIResult<String> {
|
||||||
|
|
||||||
// Generate json from whole config
|
// Generate json from whole config
|
||||||
let jc = serde_json::to_string(self).map_err(VeilidAPIError::generic)?;
|
let jc = serde_json::to_string(self).map_err(VeilidAPIError::generic)?;
|
||||||
let jvc = json::parse(&jc).map_err(VeilidAPIError::generic)?;
|
let jvc = json::parse(&jc).map_err(VeilidAPIError::generic)?;
|
||||||
|
|
@ -1030,7 +1030,7 @@ impl VeilidConfig {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate(&self) -> VeilidAPIResult<()> {
|
pub fn validate(&self) -> VeilidAPIResult<()> {
|
||||||
Self::validate_program_name(&self.program_name)?;
|
Self::validate_program_name(&self.program_name)?;
|
||||||
Self::validate_namespace(&self.namespace)?;
|
Self::validate_namespace(&self.namespace)?;
|
||||||
|
|
||||||
|
|
@ -1137,11 +1137,16 @@ impl fmt::Debug for VeilidStartupOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VeilidStartupOptions {
|
impl VeilidStartupOptions {
|
||||||
pub(crate) fn new_from_config(config: VeilidConfig, update_cb: UpdateCallback) -> Self {
|
pub(crate) fn try_new(
|
||||||
Self {
|
config: VeilidConfig,
|
||||||
|
update_cb: UpdateCallback,
|
||||||
|
) -> VeilidAPIResult<Self> {
|
||||||
|
config.validate()?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
update_cb,
|
update_cb,
|
||||||
config: Arc::new(config),
|
config: Arc::new(config),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -1149,6 +1154,7 @@ impl VeilidStartupOptions {
|
||||||
self.update_cb.clone()
|
self.update_cb.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[must_use]
|
||||||
pub fn config(&self) -> Arc<VeilidConfig> {
|
pub fn config(&self) -> Arc<VeilidConfig> {
|
||||||
self.config.clone()
|
self.config.clone()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ Future<void> testGetCryptoSystems() async {
|
||||||
const CryptoKind invalidCryptoKind = cryptoKindNONE + 1;
|
const CryptoKind invalidCryptoKind = cryptoKindNONE + 1;
|
||||||
|
|
||||||
Future<void> testGetCryptoSystemInvalid() async {
|
Future<void> testGetCryptoSystemInvalid() async {
|
||||||
await expectLater(
|
await expectLater(() => Veilid.instance.getCryptoSystem(invalidCryptoKind),
|
||||||
() async => Veilid.instance.getCryptoSystem(invalidCryptoKind),
|
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ final bogusKey =
|
||||||
Future<void> testGetDHTValueUnopened() async {
|
Future<void> testGetDHTValueUnopened() async {
|
||||||
final rc = await Veilid.instance.routingContext();
|
final rc = await Veilid.instance.routingContext();
|
||||||
try {
|
try {
|
||||||
await expectLater(() async => rc.getDHTValue(bogusKey, 0),
|
await expectLater(
|
||||||
throwsA(isA<VeilidAPIException>()));
|
() => rc.getDHTValue(bogusKey, 0), throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
rc.close();
|
rc.close();
|
||||||
}
|
}
|
||||||
|
|
@ -20,8 +20,8 @@ Future<void> testGetDHTValueUnopened() async {
|
||||||
Future<void> testOpenDHTRecordNonexistentNoWriter() async {
|
Future<void> testOpenDHTRecordNonexistentNoWriter() async {
|
||||||
final rc = await Veilid.instance.routingContext();
|
final rc = await Veilid.instance.routingContext();
|
||||||
try {
|
try {
|
||||||
await expectLater(() async => rc.openDHTRecord(bogusKey),
|
await expectLater(
|
||||||
throwsA(isA<VeilidAPIException>()));
|
() => rc.openDHTRecord(bogusKey), throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
rc.close();
|
rc.close();
|
||||||
}
|
}
|
||||||
|
|
@ -30,8 +30,8 @@ Future<void> testOpenDHTRecordNonexistentNoWriter() async {
|
||||||
Future<void> testCloseDHTRecordNonexistent() async {
|
Future<void> testCloseDHTRecordNonexistent() async {
|
||||||
final rc = await Veilid.instance.routingContext();
|
final rc = await Veilid.instance.routingContext();
|
||||||
try {
|
try {
|
||||||
await expectLater(() async => rc.closeDHTRecord(bogusKey),
|
await expectLater(
|
||||||
throwsA(isA<VeilidAPIException>()));
|
() => rc.closeDHTRecord(bogusKey), throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
rc.close();
|
rc.close();
|
||||||
}
|
}
|
||||||
|
|
@ -40,8 +40,8 @@ Future<void> testCloseDHTRecordNonexistent() async {
|
||||||
Future<void> testDeleteDHTRecordNonexistent() async {
|
Future<void> testDeleteDHTRecordNonexistent() async {
|
||||||
final rc = await Veilid.instance.routingContext();
|
final rc = await Veilid.instance.routingContext();
|
||||||
try {
|
try {
|
||||||
await expectLater(() async => rc.deleteDHTRecord(bogusKey),
|
await expectLater(
|
||||||
throwsA(isA<VeilidAPIException>()));
|
() => rc.deleteDHTRecord(bogusKey), throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
rc.close();
|
rc.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ Future<void> testOpenDeleteTableDb() async {
|
||||||
|
|
||||||
final tdb = await Veilid.instance.openTableDB(testDb, 1);
|
final tdb = await Veilid.instance.openTableDB(testDb, 1);
|
||||||
try {
|
try {
|
||||||
await expectLater(() async => Veilid.instance.deleteTableDB(testDb),
|
await expectLater(() => Veilid.instance.deleteTableDB(testDb),
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
tdb.close();
|
tdb.close();
|
||||||
|
|
@ -32,11 +32,11 @@ Future<void> testOpenTwiceTableDb() async {
|
||||||
final tdb2 = await Veilid.instance.openTableDB(testDb, 1);
|
final tdb2 = await Veilid.instance.openTableDB(testDb, 1);
|
||||||
|
|
||||||
// delete should fail because open
|
// delete should fail because open
|
||||||
await expectLater(() async => Veilid.instance.deleteTableDB(testDb),
|
await expectLater(() => Veilid.instance.deleteTableDB(testDb),
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
tdb.close();
|
tdb.close();
|
||||||
// delete should fail because open
|
// delete should fail because open
|
||||||
await expectLater(() async => Veilid.instance.deleteTableDB(testDb),
|
await expectLater(() => Veilid.instance.deleteTableDB(testDb),
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
tdb2.close();
|
tdb2.close();
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ Future<void> testResizeTableDb() async {
|
||||||
final tdb = await Veilid.instance.openTableDB(testDb, 1);
|
final tdb = await Veilid.instance.openTableDB(testDb, 1);
|
||||||
try {
|
try {
|
||||||
// reopen the db with more columns should fail if it is already open
|
// reopen the db with more columns should fail if it is already open
|
||||||
await expectLater(() async => Veilid.instance.openTableDB(testDb, 2),
|
await expectLater(() => Veilid.instance.openTableDB(testDb, 2),
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
} finally {
|
} finally {
|
||||||
tdb.close();
|
tdb.close();
|
||||||
|
|
@ -115,7 +115,7 @@ Future<void> testResizeTableDb() async {
|
||||||
final tdb3 = await Veilid.instance.openTableDB(testDb, 1);
|
final tdb3 = await Veilid.instance.openTableDB(testDb, 1);
|
||||||
try {
|
try {
|
||||||
// Should fail access to second column
|
// Should fail access to second column
|
||||||
await expectLater(() async => tdb3.load(1, utf8.encode('qwer')),
|
await expectLater(() => tdb3.load(1, utf8.encode('qwer')),
|
||||||
throwsA(isA<VeilidAPIException>()));
|
throwsA(isA<VeilidAPIException>()));
|
||||||
|
|
||||||
// Should succeed with access to second column
|
// Should succeed with access to second column
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.4.7"
|
version: "0.4.8"
|
||||||
veilid_test:
|
veilid_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -195,23 +195,23 @@ sealed class VeilidConfigWS with _$VeilidConfigWS {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
@Deprecated('WSS is disabled by default in veilid-flutter')
|
// @Deprecated('WSS is disabled by default in veilid-flutter')
|
||||||
@freezed
|
// @freezed
|
||||||
sealed class VeilidConfigWSS with _$VeilidConfigWSS {
|
// sealed class VeilidConfigWSS with _$VeilidConfigWSS {
|
||||||
@Deprecated('WSS is disabled by default in veilid-flutter')
|
// @Deprecated('WSS is disabled by default in veilid-flutter')
|
||||||
const factory VeilidConfigWSS({
|
// const factory VeilidConfigWSS({
|
||||||
required bool connect,
|
// required bool connect,
|
||||||
required bool listen,
|
// required bool listen,
|
||||||
required int maxConnections,
|
// required int maxConnections,
|
||||||
required String listenAddress,
|
// required String listenAddress,
|
||||||
required String path,
|
// required String path,
|
||||||
String? url,
|
// String? url,
|
||||||
}) = _VeilidConfigWSS;
|
// }) = _VeilidConfigWSS;
|
||||||
|
|
||||||
@Deprecated('WSS is disabled by default in veilid-flutter')
|
// @Deprecated('WSS is disabled by default in veilid-flutter')
|
||||||
factory VeilidConfigWSS.fromJson(dynamic json) =>
|
// factory VeilidConfigWSS.fromJson(dynamic json) =>
|
||||||
_$VeilidConfigWSSFromJson(json as Map<String, dynamic>);
|
// _$VeilidConfigWSSFromJson(json as Map<String, dynamic>);
|
||||||
}
|
// }
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
|
@ -221,8 +221,7 @@ sealed class VeilidConfigProtocol with _$VeilidConfigProtocol {
|
||||||
required VeilidConfigUDP udp,
|
required VeilidConfigUDP udp,
|
||||||
required VeilidConfigTCP tcp,
|
required VeilidConfigTCP tcp,
|
||||||
required VeilidConfigWS ws,
|
required VeilidConfigWS ws,
|
||||||
@Deprecated('WSS is disabled by default in veilid-flutter')
|
// required VeilidConfigWSS wss,
|
||||||
required VeilidConfigWSS wss,
|
|
||||||
}) = _VeilidConfigProtocol;
|
}) = _VeilidConfigProtocol;
|
||||||
|
|
||||||
factory VeilidConfigProtocol.fromJson(dynamic json) =>
|
factory VeilidConfigProtocol.fromJson(dynamic json) =>
|
||||||
|
|
|
||||||
|
|
@ -3776,294 +3776,10 @@ as String?,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
mixin _$VeilidConfigWSS implements DiagnosticableTreeMixin {
|
|
||||||
|
|
||||||
bool get connect; bool get listen; int get maxConnections; String get listenAddress; String get path; String? get url;
|
|
||||||
/// Create a copy of VeilidConfigWSS
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$VeilidConfigWSSCopyWith<VeilidConfigWSS> get copyWith => _$VeilidConfigWSSCopyWithImpl<VeilidConfigWSS>(this as VeilidConfigWSS, _$identity);
|
|
||||||
|
|
||||||
/// Serializes this VeilidConfigWSS to a JSON map.
|
|
||||||
Map<String, dynamic> toJson();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
||||||
properties
|
|
||||||
..add(DiagnosticsProperty('type', 'VeilidConfigWSS'))
|
|
||||||
..add(DiagnosticsProperty('connect', connect))..add(DiagnosticsProperty('listen', listen))..add(DiagnosticsProperty('maxConnections', maxConnections))..add(DiagnosticsProperty('listenAddress', listenAddress))..add(DiagnosticsProperty('path', path))..add(DiagnosticsProperty('url', url));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VeilidConfigWSS&&(identical(other.connect, connect) || other.connect == connect)&&(identical(other.listen, listen) || other.listen == listen)&&(identical(other.maxConnections, maxConnections) || other.maxConnections == maxConnections)&&(identical(other.listenAddress, listenAddress) || other.listenAddress == listenAddress)&&(identical(other.path, path) || other.path == path)&&(identical(other.url, url) || other.url == url));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType,connect,listen,maxConnections,listenAddress,path,url);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
|
||||||
return 'VeilidConfigWSS(connect: $connect, listen: $listen, maxConnections: $maxConnections, listenAddress: $listenAddress, path: $path, url: $url)';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract mixin class $VeilidConfigWSSCopyWith<$Res> {
|
|
||||||
factory $VeilidConfigWSSCopyWith(VeilidConfigWSS value, $Res Function(VeilidConfigWSS) _then) = _$VeilidConfigWSSCopyWithImpl;
|
|
||||||
@useResult
|
|
||||||
$Res call({
|
|
||||||
bool connect, bool listen, int maxConnections, String listenAddress, String path, String? url
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/// @nodoc
|
|
||||||
class _$VeilidConfigWSSCopyWithImpl<$Res>
|
|
||||||
implements $VeilidConfigWSSCopyWith<$Res> {
|
|
||||||
_$VeilidConfigWSSCopyWithImpl(this._self, this._then);
|
|
||||||
|
|
||||||
final VeilidConfigWSS _self;
|
|
||||||
final $Res Function(VeilidConfigWSS) _then;
|
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigWSS
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? connect = null,Object? listen = null,Object? maxConnections = null,Object? listenAddress = null,Object? path = null,Object? url = freezed,}) {
|
|
||||||
return _then(_self.copyWith(
|
|
||||||
connect: null == connect ? _self.connect : connect // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,listen: null == listen ? _self.listen : listen // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,maxConnections: null == maxConnections ? _self.maxConnections : maxConnections // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int,listenAddress: null == listenAddress ? _self.listenAddress : listenAddress // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Adds pattern-matching-related methods to [VeilidConfigWSS].
|
|
||||||
extension VeilidConfigWSSPatterns on VeilidConfigWSS {
|
|
||||||
/// A variant of `map` that fallback to returning `orElse`.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return orElse();
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _VeilidConfigWSS value)? $default,{required TResult orElse(),}){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS() when $default != null:
|
|
||||||
return $default(_that);case _:
|
|
||||||
return orElse();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A `switch`-like method, using callbacks.
|
|
||||||
///
|
|
||||||
/// Callbacks receives the raw object, upcasted.
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case final Subclass2 value:
|
|
||||||
/// return ...;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _VeilidConfigWSS value) $default,){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS():
|
|
||||||
return $default(_that);}
|
|
||||||
}
|
|
||||||
/// A variant of `map` that fallback to returning `null`.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case final Subclass value:
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return null;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _VeilidConfigWSS value)? $default,){
|
|
||||||
final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS() when $default != null:
|
|
||||||
return $default(_that);case _:
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A variant of `when` that fallback to an `orElse` callback.
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return orElse();
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool connect, bool listen, int maxConnections, String listenAddress, String path, String? url)? $default,{required TResult orElse(),}) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS() when $default != null:
|
|
||||||
return $default(_that.connect,_that.listen,_that.maxConnections,_that.listenAddress,_that.path,_that.url);case _:
|
|
||||||
return orElse();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// A `switch`-like method, using callbacks.
|
|
||||||
///
|
|
||||||
/// As opposed to `map`, this offers destructuring.
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case Subclass2(:final field2):
|
|
||||||
/// return ...;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool connect, bool listen, int maxConnections, String listenAddress, String path, String? url) $default,) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS():
|
|
||||||
return $default(_that.connect,_that.listen,_that.maxConnections,_that.listenAddress,_that.path,_that.url);}
|
|
||||||
}
|
|
||||||
/// A variant of `when` that fallback to returning `null`
|
|
||||||
///
|
|
||||||
/// It is equivalent to doing:
|
|
||||||
/// ```dart
|
|
||||||
/// switch (sealedClass) {
|
|
||||||
/// case Subclass(:final field):
|
|
||||||
/// return ...;
|
|
||||||
/// case _:
|
|
||||||
/// return null;
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool connect, bool listen, int maxConnections, String listenAddress, String path, String? url)? $default,) {final _that = this;
|
|
||||||
switch (_that) {
|
|
||||||
case _VeilidConfigWSS() when $default != null:
|
|
||||||
return $default(_that.connect,_that.listen,_that.maxConnections,_that.listenAddress,_that.path,_that.url);case _:
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
@JsonSerializable()
|
|
||||||
@Deprecated('WSS is disabled by default in veilid-flutter')
|
|
||||||
class _VeilidConfigWSS with DiagnosticableTreeMixin implements VeilidConfigWSS {
|
|
||||||
const _VeilidConfigWSS({required this.connect, required this.listen, required this.maxConnections, required this.listenAddress, required this.path, this.url});
|
|
||||||
factory _VeilidConfigWSS.fromJson(Map<String, dynamic> json) => _$VeilidConfigWSSFromJson(json);
|
|
||||||
|
|
||||||
@override final bool connect;
|
|
||||||
@override final bool listen;
|
|
||||||
@override final int maxConnections;
|
|
||||||
@override final String listenAddress;
|
|
||||||
@override final String path;
|
|
||||||
@override final String? url;
|
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigWSS
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
_$VeilidConfigWSSCopyWith<_VeilidConfigWSS> get copyWith => __$VeilidConfigWSSCopyWithImpl<_VeilidConfigWSS>(this, _$identity);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return _$VeilidConfigWSSToJson(this, );
|
|
||||||
}
|
|
||||||
@override
|
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
||||||
properties
|
|
||||||
..add(DiagnosticsProperty('type', 'VeilidConfigWSS'))
|
|
||||||
..add(DiagnosticsProperty('connect', connect))..add(DiagnosticsProperty('listen', listen))..add(DiagnosticsProperty('maxConnections', maxConnections))..add(DiagnosticsProperty('listenAddress', listenAddress))..add(DiagnosticsProperty('path', path))..add(DiagnosticsProperty('url', url));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VeilidConfigWSS&&(identical(other.connect, connect) || other.connect == connect)&&(identical(other.listen, listen) || other.listen == listen)&&(identical(other.maxConnections, maxConnections) || other.maxConnections == maxConnections)&&(identical(other.listenAddress, listenAddress) || other.listenAddress == listenAddress)&&(identical(other.path, path) || other.path == path)&&(identical(other.url, url) || other.url == url));
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
|
||||||
int get hashCode => Object.hash(runtimeType,connect,listen,maxConnections,listenAddress,path,url);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
|
||||||
return 'VeilidConfigWSS(connect: $connect, listen: $listen, maxConnections: $maxConnections, listenAddress: $listenAddress, path: $path, url: $url)';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @nodoc
|
|
||||||
abstract mixin class _$VeilidConfigWSSCopyWith<$Res> implements $VeilidConfigWSSCopyWith<$Res> {
|
|
||||||
factory _$VeilidConfigWSSCopyWith(_VeilidConfigWSS value, $Res Function(_VeilidConfigWSS) _then) = __$VeilidConfigWSSCopyWithImpl;
|
|
||||||
@override @useResult
|
|
||||||
$Res call({
|
|
||||||
bool connect, bool listen, int maxConnections, String listenAddress, String path, String? url
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/// @nodoc
|
|
||||||
class __$VeilidConfigWSSCopyWithImpl<$Res>
|
|
||||||
implements _$VeilidConfigWSSCopyWith<$Res> {
|
|
||||||
__$VeilidConfigWSSCopyWithImpl(this._self, this._then);
|
|
||||||
|
|
||||||
final _VeilidConfigWSS _self;
|
|
||||||
final $Res Function(_VeilidConfigWSS) _then;
|
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigWSS
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? connect = null,Object? listen = null,Object? maxConnections = null,Object? listenAddress = null,Object? path = null,Object? url = freezed,}) {
|
|
||||||
return _then(_VeilidConfigWSS(
|
|
||||||
connect: null == connect ? _self.connect : connect // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,listen: null == listen ? _self.listen : listen // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,maxConnections: null == maxConnections ? _self.maxConnections : maxConnections // ignore: cast_nullable_to_non_nullable
|
|
||||||
as int,listenAddress: null == listenAddress ? _self.listenAddress : listenAddress // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,path: null == path ? _self.path : path // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,url: freezed == url ? _self.url : url // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$VeilidConfigProtocol implements DiagnosticableTreeMixin {
|
mixin _$VeilidConfigProtocol implements DiagnosticableTreeMixin {
|
||||||
|
|
||||||
VeilidConfigUDP get udp; VeilidConfigTCP get tcp; VeilidConfigWS get ws;@Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS get wss;
|
VeilidConfigUDP get udp; VeilidConfigTCP get tcp; VeilidConfigWS get ws;
|
||||||
/// Create a copy of VeilidConfigProtocol
|
/// Create a copy of VeilidConfigProtocol
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
|
@ -4077,21 +3793,21 @@ $VeilidConfigProtocolCopyWith<VeilidConfigProtocol> get copyWith => _$VeilidConf
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||||
properties
|
properties
|
||||||
..add(DiagnosticsProperty('type', 'VeilidConfigProtocol'))
|
..add(DiagnosticsProperty('type', 'VeilidConfigProtocol'))
|
||||||
..add(DiagnosticsProperty('udp', udp))..add(DiagnosticsProperty('tcp', tcp))..add(DiagnosticsProperty('ws', ws))..add(DiagnosticsProperty('wss', wss));
|
..add(DiagnosticsProperty('udp', udp))..add(DiagnosticsProperty('tcp', tcp))..add(DiagnosticsProperty('ws', ws));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VeilidConfigProtocol&&(identical(other.udp, udp) || other.udp == udp)&&(identical(other.tcp, tcp) || other.tcp == tcp)&&(identical(other.ws, ws) || other.ws == ws)&&(identical(other.wss, wss) || other.wss == wss));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is VeilidConfigProtocol&&(identical(other.udp, udp) || other.udp == udp)&&(identical(other.tcp, tcp) || other.tcp == tcp)&&(identical(other.ws, ws) || other.ws == ws));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,udp,tcp,ws,wss);
|
int get hashCode => Object.hash(runtimeType,udp,tcp,ws);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||||
return 'VeilidConfigProtocol(udp: $udp, tcp: $tcp, ws: $ws, wss: $wss)';
|
return 'VeilidConfigProtocol(udp: $udp, tcp: $tcp, ws: $ws)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4102,11 +3818,11 @@ abstract mixin class $VeilidConfigProtocolCopyWith<$Res> {
|
||||||
factory $VeilidConfigProtocolCopyWith(VeilidConfigProtocol value, $Res Function(VeilidConfigProtocol) _then) = _$VeilidConfigProtocolCopyWithImpl;
|
factory $VeilidConfigProtocolCopyWith(VeilidConfigProtocol value, $Res Function(VeilidConfigProtocol) _then) = _$VeilidConfigProtocolCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws,@Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS wss
|
VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$VeilidConfigUDPCopyWith<$Res> get udp;$VeilidConfigTCPCopyWith<$Res> get tcp;$VeilidConfigWSCopyWith<$Res> get ws;$VeilidConfigWSSCopyWith<$Res> get wss;
|
$VeilidConfigUDPCopyWith<$Res> get udp;$VeilidConfigTCPCopyWith<$Res> get tcp;$VeilidConfigWSCopyWith<$Res> get ws;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
@ -4119,13 +3835,12 @@ class _$VeilidConfigProtocolCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigProtocol
|
/// Create a copy of VeilidConfigProtocol
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? udp = null,Object? tcp = null,Object? ws = null,Object? wss = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? udp = null,Object? tcp = null,Object? ws = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
udp: null == udp ? _self.udp : udp // ignore: cast_nullable_to_non_nullable
|
udp: null == udp ? _self.udp : udp // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigUDP,tcp: null == tcp ? _self.tcp : tcp // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigUDP,tcp: null == tcp ? _self.tcp : tcp // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigTCP,ws: null == ws ? _self.ws : ws // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigTCP,ws: null == ws ? _self.ws : ws // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigWS,wss: null == wss ? _self.wss : wss // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigWS,
|
||||||
as VeilidConfigWSS,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/// Create a copy of VeilidConfigProtocol
|
/// Create a copy of VeilidConfigProtocol
|
||||||
|
|
@ -4155,15 +3870,6 @@ $VeilidConfigWSCopyWith<$Res> get ws {
|
||||||
return $VeilidConfigWSCopyWith<$Res>(_self.ws, (value) {
|
return $VeilidConfigWSCopyWith<$Res>(_self.ws, (value) {
|
||||||
return _then(_self.copyWith(ws: value));
|
return _then(_self.copyWith(ws: value));
|
||||||
});
|
});
|
||||||
}/// Create a copy of VeilidConfigProtocol
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$VeilidConfigWSSCopyWith<$Res> get wss {
|
|
||||||
|
|
||||||
return $VeilidConfigWSSCopyWith<$Res>(_self.wss, (value) {
|
|
||||||
return _then(_self.copyWith(wss: value));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4243,10 +3949,10 @@ return $default(_that);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws, @Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS wss)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _VeilidConfigProtocol() when $default != null:
|
case _VeilidConfigProtocol() when $default != null:
|
||||||
return $default(_that.udp,_that.tcp,_that.ws,_that.wss);case _:
|
return $default(_that.udp,_that.tcp,_that.ws);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4264,10 +3970,10 @@ return $default(_that.udp,_that.tcp,_that.ws,_that.wss);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws, @Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS wss) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _VeilidConfigProtocol():
|
case _VeilidConfigProtocol():
|
||||||
return $default(_that.udp,_that.tcp,_that.ws,_that.wss);}
|
return $default(_that.udp,_that.tcp,_that.ws);}
|
||||||
}
|
}
|
||||||
/// A variant of `when` that fallback to returning `null`
|
/// A variant of `when` that fallback to returning `null`
|
||||||
///
|
///
|
||||||
|
|
@ -4281,10 +3987,10 @@ return $default(_that.udp,_that.tcp,_that.ws,_that.wss);}
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws, @Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS wss)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _VeilidConfigProtocol() when $default != null:
|
case _VeilidConfigProtocol() when $default != null:
|
||||||
return $default(_that.udp,_that.tcp,_that.ws,_that.wss);case _:
|
return $default(_that.udp,_that.tcp,_that.ws);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4296,13 +4002,12 @@ return $default(_that.udp,_that.tcp,_that.ws,_that.wss);case _:
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _VeilidConfigProtocol with DiagnosticableTreeMixin implements VeilidConfigProtocol {
|
class _VeilidConfigProtocol with DiagnosticableTreeMixin implements VeilidConfigProtocol {
|
||||||
const _VeilidConfigProtocol({required this.udp, required this.tcp, required this.ws, @Deprecated('WSS is disabled by default in veilid-flutter') required this.wss});
|
const _VeilidConfigProtocol({required this.udp, required this.tcp, required this.ws});
|
||||||
factory _VeilidConfigProtocol.fromJson(Map<String, dynamic> json) => _$VeilidConfigProtocolFromJson(json);
|
factory _VeilidConfigProtocol.fromJson(Map<String, dynamic> json) => _$VeilidConfigProtocolFromJson(json);
|
||||||
|
|
||||||
@override final VeilidConfigUDP udp;
|
@override final VeilidConfigUDP udp;
|
||||||
@override final VeilidConfigTCP tcp;
|
@override final VeilidConfigTCP tcp;
|
||||||
@override final VeilidConfigWS ws;
|
@override final VeilidConfigWS ws;
|
||||||
@override@Deprecated('WSS is disabled by default in veilid-flutter') final VeilidConfigWSS wss;
|
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigProtocol
|
/// Create a copy of VeilidConfigProtocol
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
|
@ -4318,21 +4023,21 @@ Map<String, dynamic> toJson() {
|
||||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||||
properties
|
properties
|
||||||
..add(DiagnosticsProperty('type', 'VeilidConfigProtocol'))
|
..add(DiagnosticsProperty('type', 'VeilidConfigProtocol'))
|
||||||
..add(DiagnosticsProperty('udp', udp))..add(DiagnosticsProperty('tcp', tcp))..add(DiagnosticsProperty('ws', ws))..add(DiagnosticsProperty('wss', wss));
|
..add(DiagnosticsProperty('udp', udp))..add(DiagnosticsProperty('tcp', tcp))..add(DiagnosticsProperty('ws', ws));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VeilidConfigProtocol&&(identical(other.udp, udp) || other.udp == udp)&&(identical(other.tcp, tcp) || other.tcp == tcp)&&(identical(other.ws, ws) || other.ws == ws)&&(identical(other.wss, wss) || other.wss == wss));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _VeilidConfigProtocol&&(identical(other.udp, udp) || other.udp == udp)&&(identical(other.tcp, tcp) || other.tcp == tcp)&&(identical(other.ws, ws) || other.ws == ws));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,udp,tcp,ws,wss);
|
int get hashCode => Object.hash(runtimeType,udp,tcp,ws);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||||
return 'VeilidConfigProtocol(udp: $udp, tcp: $tcp, ws: $ws, wss: $wss)';
|
return 'VeilidConfigProtocol(udp: $udp, tcp: $tcp, ws: $ws)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4343,11 +4048,11 @@ abstract mixin class _$VeilidConfigProtocolCopyWith<$Res> implements $VeilidConf
|
||||||
factory _$VeilidConfigProtocolCopyWith(_VeilidConfigProtocol value, $Res Function(_VeilidConfigProtocol) _then) = __$VeilidConfigProtocolCopyWithImpl;
|
factory _$VeilidConfigProtocolCopyWith(_VeilidConfigProtocol value, $Res Function(_VeilidConfigProtocol) _then) = __$VeilidConfigProtocolCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws,@Deprecated('WSS is disabled by default in veilid-flutter') VeilidConfigWSS wss
|
VeilidConfigUDP udp, VeilidConfigTCP tcp, VeilidConfigWS ws
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $VeilidConfigUDPCopyWith<$Res> get udp;@override $VeilidConfigTCPCopyWith<$Res> get tcp;@override $VeilidConfigWSCopyWith<$Res> get ws;@override $VeilidConfigWSSCopyWith<$Res> get wss;
|
@override $VeilidConfigUDPCopyWith<$Res> get udp;@override $VeilidConfigTCPCopyWith<$Res> get tcp;@override $VeilidConfigWSCopyWith<$Res> get ws;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
@ -4360,13 +4065,12 @@ class __$VeilidConfigProtocolCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of VeilidConfigProtocol
|
/// Create a copy of VeilidConfigProtocol
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? udp = null,Object? tcp = null,Object? ws = null,Object? wss = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? udp = null,Object? tcp = null,Object? ws = null,}) {
|
||||||
return _then(_VeilidConfigProtocol(
|
return _then(_VeilidConfigProtocol(
|
||||||
udp: null == udp ? _self.udp : udp // ignore: cast_nullable_to_non_nullable
|
udp: null == udp ? _self.udp : udp // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigUDP,tcp: null == tcp ? _self.tcp : tcp // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigUDP,tcp: null == tcp ? _self.tcp : tcp // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigTCP,ws: null == ws ? _self.ws : ws // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigTCP,ws: null == ws ? _self.ws : ws // ignore: cast_nullable_to_non_nullable
|
||||||
as VeilidConfigWS,wss: null == wss ? _self.wss : wss // ignore: cast_nullable_to_non_nullable
|
as VeilidConfigWS,
|
||||||
as VeilidConfigWSS,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4397,15 +4101,6 @@ $VeilidConfigWSCopyWith<$Res> get ws {
|
||||||
return $VeilidConfigWSCopyWith<$Res>(_self.ws, (value) {
|
return $VeilidConfigWSCopyWith<$Res>(_self.ws, (value) {
|
||||||
return _then(_self.copyWith(ws: value));
|
return _then(_self.copyWith(ws: value));
|
||||||
});
|
});
|
||||||
}/// Create a copy of VeilidConfigProtocol
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$VeilidConfigWSSCopyWith<$Res> get wss {
|
|
||||||
|
|
||||||
return $VeilidConfigWSSCopyWith<$Res>(_self.wss, (value) {
|
|
||||||
return _then(_self.copyWith(wss: value));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,33 +225,12 @@ Map<String, dynamic> _$VeilidConfigWSToJson(_VeilidConfigWS instance) =>
|
||||||
'url': instance.url,
|
'url': instance.url,
|
||||||
};
|
};
|
||||||
|
|
||||||
_VeilidConfigWSS _$VeilidConfigWSSFromJson(Map<String, dynamic> json) =>
|
|
||||||
_VeilidConfigWSS(
|
|
||||||
connect: json['connect'] as bool,
|
|
||||||
listen: json['listen'] as bool,
|
|
||||||
maxConnections: (json['max_connections'] as num).toInt(),
|
|
||||||
listenAddress: json['listen_address'] as String,
|
|
||||||
path: json['path'] as String,
|
|
||||||
url: json['url'] as String?,
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> _$VeilidConfigWSSToJson(_VeilidConfigWSS instance) =>
|
|
||||||
<String, dynamic>{
|
|
||||||
'connect': instance.connect,
|
|
||||||
'listen': instance.listen,
|
|
||||||
'max_connections': instance.maxConnections,
|
|
||||||
'listen_address': instance.listenAddress,
|
|
||||||
'path': instance.path,
|
|
||||||
'url': instance.url,
|
|
||||||
};
|
|
||||||
|
|
||||||
_VeilidConfigProtocol _$VeilidConfigProtocolFromJson(
|
_VeilidConfigProtocol _$VeilidConfigProtocolFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _VeilidConfigProtocol(
|
) => _VeilidConfigProtocol(
|
||||||
udp: VeilidConfigUDP.fromJson(json['udp']),
|
udp: VeilidConfigUDP.fromJson(json['udp']),
|
||||||
tcp: VeilidConfigTCP.fromJson(json['tcp']),
|
tcp: VeilidConfigTCP.fromJson(json['tcp']),
|
||||||
ws: VeilidConfigWS.fromJson(json['ws']),
|
ws: VeilidConfigWS.fromJson(json['ws']),
|
||||||
wss: VeilidConfigWSS.fromJson(json['wss']),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$VeilidConfigProtocolToJson(
|
Map<String, dynamic> _$VeilidConfigProtocolToJson(
|
||||||
|
|
@ -260,7 +239,6 @@ Map<String, dynamic> _$VeilidConfigProtocolToJson(
|
||||||
'udp': instance.udp.toJson(),
|
'udp': instance.udp.toJson(),
|
||||||
'tcp': instance.tcp.toJson(),
|
'tcp': instance.tcp.toJson(),
|
||||||
'ws': instance.ws.toJson(),
|
'ws': instance.ws.toJson(),
|
||||||
'wss': instance.wss.toJson(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_VeilidConfigPrivacy _$VeilidConfigPrivacyFromJson(Map<String, dynamic> json) =>
|
_VeilidConfigPrivacy _$VeilidConfigPrivacyFromJson(Map<String, dynamic> json) =>
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ sealed class PeerStats with _$PeerStats {
|
||||||
@freezed
|
@freezed
|
||||||
sealed class PeerTableData with _$PeerTableData {
|
sealed class PeerTableData with _$PeerTableData {
|
||||||
const factory PeerTableData({
|
const factory PeerTableData({
|
||||||
required List<PublicKey> nodeIds,
|
required List<NodeId> nodeIds,
|
||||||
required String peerAddress,
|
required String peerAddress,
|
||||||
required PeerStats peerStats,
|
required PeerStats peerStats,
|
||||||
}) = _PeerTableData;
|
}) = _PeerTableData;
|
||||||
|
|
@ -218,20 +218,22 @@ sealed class VeilidUpdate with _$VeilidUpdate {
|
||||||
PublicKey? sender,
|
PublicKey? sender,
|
||||||
String? routeId,
|
String? routeId,
|
||||||
}) = VeilidAppCall;
|
}) = VeilidAppCall;
|
||||||
const factory VeilidUpdate.attachment(
|
const factory VeilidUpdate.attachment({
|
||||||
{required AttachmentState state,
|
required AttachmentState state,
|
||||||
required bool publicInternetReady,
|
required bool publicInternetReady,
|
||||||
required bool localNetworkReady,
|
required bool localNetworkReady,
|
||||||
required TimestampDuration uptime,
|
required TimestampDuration uptime,
|
||||||
required TimestampDuration? attachedUptime}) = VeilidUpdateAttachment;
|
required TimestampDuration? attachedUptime,
|
||||||
const factory VeilidUpdate.network(
|
}) = VeilidUpdateAttachment;
|
||||||
{required bool started,
|
const factory VeilidUpdate.network({
|
||||||
|
required bool started,
|
||||||
required BigInt bpsDown,
|
required BigInt bpsDown,
|
||||||
required BigInt bpsUp,
|
required BigInt bpsUp,
|
||||||
required List<PeerTableData> peers}) = VeilidUpdateNetwork;
|
required List<PeerTableData> peers,
|
||||||
const factory VeilidUpdate.config({
|
required List<NodeId> nodeIds,
|
||||||
required VeilidConfig config,
|
}) = VeilidUpdateNetwork;
|
||||||
}) = VeilidUpdateConfig;
|
const factory VeilidUpdate.config({required VeilidConfig config}) =
|
||||||
|
VeilidUpdateConfig;
|
||||||
const factory VeilidUpdate.routeChange({
|
const factory VeilidUpdate.routeChange({
|
||||||
required List<String> deadRoutes,
|
required List<String> deadRoutes,
|
||||||
required List<String> deadRemoteRoutes,
|
required List<String> deadRemoteRoutes,
|
||||||
|
|
@ -252,12 +254,13 @@ sealed class VeilidUpdate with _$VeilidUpdate {
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class VeilidStateAttachment with _$VeilidStateAttachment {
|
sealed class VeilidStateAttachment with _$VeilidStateAttachment {
|
||||||
const factory VeilidStateAttachment(
|
const factory VeilidStateAttachment({
|
||||||
{required AttachmentState state,
|
required AttachmentState state,
|
||||||
required bool publicInternetReady,
|
required bool publicInternetReady,
|
||||||
required bool localNetworkReady,
|
required bool localNetworkReady,
|
||||||
required TimestampDuration uptime,
|
required TimestampDuration uptime,
|
||||||
required TimestampDuration? attachedUptime}) = _VeilidStateAttachment;
|
required TimestampDuration? attachedUptime,
|
||||||
|
}) = _VeilidStateAttachment;
|
||||||
|
|
||||||
factory VeilidStateAttachment.fromJson(dynamic json) =>
|
factory VeilidStateAttachment.fromJson(dynamic json) =>
|
||||||
_$VeilidStateAttachmentFromJson(json as Map<String, dynamic>);
|
_$VeilidStateAttachmentFromJson(json as Map<String, dynamic>);
|
||||||
|
|
@ -268,11 +271,12 @@ sealed class VeilidStateAttachment with _$VeilidStateAttachment {
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class VeilidStateNetwork with _$VeilidStateNetwork {
|
sealed class VeilidStateNetwork with _$VeilidStateNetwork {
|
||||||
const factory VeilidStateNetwork(
|
const factory VeilidStateNetwork({
|
||||||
{required bool started,
|
required bool started,
|
||||||
required BigInt bpsDown,
|
required BigInt bpsDown,
|
||||||
required BigInt bpsUp,
|
required BigInt bpsUp,
|
||||||
required List<PeerTableData> peers}) = _VeilidStateNetwork;
|
required List<PeerTableData> peers,
|
||||||
|
}) = _VeilidStateNetwork;
|
||||||
|
|
||||||
factory VeilidStateNetwork.fromJson(dynamic json) =>
|
factory VeilidStateNetwork.fromJson(dynamic json) =>
|
||||||
_$VeilidStateNetworkFromJson(json as Map<String, dynamic>);
|
_$VeilidStateNetworkFromJson(json as Map<String, dynamic>);
|
||||||
|
|
@ -283,9 +287,8 @@ sealed class VeilidStateNetwork with _$VeilidStateNetwork {
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
sealed class VeilidStateConfig with _$VeilidStateConfig {
|
sealed class VeilidStateConfig with _$VeilidStateConfig {
|
||||||
const factory VeilidStateConfig({
|
const factory VeilidStateConfig({required VeilidConfig config}) =
|
||||||
required VeilidConfig config,
|
_VeilidStateConfig;
|
||||||
}) = _VeilidStateConfig;
|
|
||||||
|
|
||||||
factory VeilidStateConfig.fromJson(dynamic json) =>
|
factory VeilidStateConfig.fromJson(dynamic json) =>
|
||||||
_$VeilidStateConfigFromJson(json as Map<String, dynamic>);
|
_$VeilidStateConfigFromJson(json as Map<String, dynamic>);
|
||||||
|
|
|
||||||
|
|
@ -2371,7 +2371,7 @@ $LatencyStatsCopyWith<$Res>? get latency {
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$PeerTableData {
|
mixin _$PeerTableData {
|
||||||
|
|
||||||
List<PublicKey> get nodeIds; String get peerAddress; PeerStats get peerStats;
|
List<NodeId> get nodeIds; String get peerAddress; PeerStats get peerStats;
|
||||||
/// Create a copy of PeerTableData
|
/// Create a copy of PeerTableData
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
|
@ -2404,7 +2404,7 @@ abstract mixin class $PeerTableDataCopyWith<$Res> {
|
||||||
factory $PeerTableDataCopyWith(PeerTableData value, $Res Function(PeerTableData) _then) = _$PeerTableDataCopyWithImpl;
|
factory $PeerTableDataCopyWith(PeerTableData value, $Res Function(PeerTableData) _then) = _$PeerTableDataCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
List<PublicKey> nodeIds, String peerAddress, PeerStats peerStats
|
List<NodeId> nodeIds, String peerAddress, PeerStats peerStats
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2424,7 +2424,7 @@ class _$PeerTableDataCopyWithImpl<$Res>
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? nodeIds = null,Object? peerAddress = null,Object? peerStats = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? nodeIds = null,Object? peerAddress = null,Object? peerStats = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
nodeIds: null == nodeIds ? _self.nodeIds : nodeIds // ignore: cast_nullable_to_non_nullable
|
nodeIds: null == nodeIds ? _self.nodeIds : nodeIds // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PublicKey>,peerAddress: null == peerAddress ? _self.peerAddress : peerAddress // ignore: cast_nullable_to_non_nullable
|
as List<NodeId>,peerAddress: null == peerAddress ? _self.peerAddress : peerAddress // ignore: cast_nullable_to_non_nullable
|
||||||
as String,peerStats: null == peerStats ? _self.peerStats : peerStats // ignore: cast_nullable_to_non_nullable
|
as String,peerStats: null == peerStats ? _self.peerStats : peerStats // ignore: cast_nullable_to_non_nullable
|
||||||
as PeerStats,
|
as PeerStats,
|
||||||
));
|
));
|
||||||
|
|
@ -2517,7 +2517,7 @@ return $default(_that);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<PublicKey> nodeIds, String peerAddress, PeerStats peerStats)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<NodeId> nodeIds, String peerAddress, PeerStats peerStats)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PeerTableData() when $default != null:
|
case _PeerTableData() when $default != null:
|
||||||
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
||||||
|
|
@ -2538,7 +2538,7 @@ return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<PublicKey> nodeIds, String peerAddress, PeerStats peerStats) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<NodeId> nodeIds, String peerAddress, PeerStats peerStats) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PeerTableData():
|
case _PeerTableData():
|
||||||
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);}
|
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);}
|
||||||
|
|
@ -2555,7 +2555,7 @@ return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);}
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<PublicKey> nodeIds, String peerAddress, PeerStats peerStats)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<NodeId> nodeIds, String peerAddress, PeerStats peerStats)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PeerTableData() when $default != null:
|
case _PeerTableData() when $default != null:
|
||||||
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
||||||
|
|
@ -2570,11 +2570,11 @@ return $default(_that.nodeIds,_that.peerAddress,_that.peerStats);case _:
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _PeerTableData implements PeerTableData {
|
class _PeerTableData implements PeerTableData {
|
||||||
const _PeerTableData({required final List<PublicKey> nodeIds, required this.peerAddress, required this.peerStats}): _nodeIds = nodeIds;
|
const _PeerTableData({required final List<NodeId> nodeIds, required this.peerAddress, required this.peerStats}): _nodeIds = nodeIds;
|
||||||
factory _PeerTableData.fromJson(Map<String, dynamic> json) => _$PeerTableDataFromJson(json);
|
factory _PeerTableData.fromJson(Map<String, dynamic> json) => _$PeerTableDataFromJson(json);
|
||||||
|
|
||||||
final List<PublicKey> _nodeIds;
|
final List<NodeId> _nodeIds;
|
||||||
@override List<PublicKey> get nodeIds {
|
@override List<NodeId> get nodeIds {
|
||||||
if (_nodeIds is EqualUnmodifiableListView) return _nodeIds;
|
if (_nodeIds is EqualUnmodifiableListView) return _nodeIds;
|
||||||
// ignore: implicit_dynamic_type
|
// ignore: implicit_dynamic_type
|
||||||
return EqualUnmodifiableListView(_nodeIds);
|
return EqualUnmodifiableListView(_nodeIds);
|
||||||
|
|
@ -2616,7 +2616,7 @@ abstract mixin class _$PeerTableDataCopyWith<$Res> implements $PeerTableDataCopy
|
||||||
factory _$PeerTableDataCopyWith(_PeerTableData value, $Res Function(_PeerTableData) _then) = __$PeerTableDataCopyWithImpl;
|
factory _$PeerTableDataCopyWith(_PeerTableData value, $Res Function(_PeerTableData) _then) = __$PeerTableDataCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
List<PublicKey> nodeIds, String peerAddress, PeerStats peerStats
|
List<NodeId> nodeIds, String peerAddress, PeerStats peerStats
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2636,7 +2636,7 @@ class __$PeerTableDataCopyWithImpl<$Res>
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? nodeIds = null,Object? peerAddress = null,Object? peerStats = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? nodeIds = null,Object? peerAddress = null,Object? peerStats = null,}) {
|
||||||
return _then(_PeerTableData(
|
return _then(_PeerTableData(
|
||||||
nodeIds: null == nodeIds ? _self._nodeIds : nodeIds // ignore: cast_nullable_to_non_nullable
|
nodeIds: null == nodeIds ? _self._nodeIds : nodeIds // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PublicKey>,peerAddress: null == peerAddress ? _self.peerAddress : peerAddress // ignore: cast_nullable_to_non_nullable
|
as List<NodeId>,peerAddress: null == peerAddress ? _self.peerAddress : peerAddress // ignore: cast_nullable_to_non_nullable
|
||||||
as String,peerStats: null == peerStats ? _self.peerStats : peerStats // ignore: cast_nullable_to_non_nullable
|
as String,peerStats: null == peerStats ? _self.peerStats : peerStats // ignore: cast_nullable_to_non_nullable
|
||||||
as PeerStats,
|
as PeerStats,
|
||||||
));
|
));
|
||||||
|
|
@ -2830,14 +2830,14 @@ return valueChange(_that);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log,TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId)? appMessage,TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId)? appCall,TResult Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime)? attachment,TResult Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers)? network,TResult Function( VeilidConfig config)? config,TResult Function( List<String> deadRoutes, List<String> deadRemoteRoutes)? routeChange,TResult Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value)? valueChange,required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>({TResult Function( VeilidLogLevel logLevel, String message, String? backtrace)? log,TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId)? appMessage,TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId)? appCall,TResult Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime)? attachment,TResult Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers, List<NodeId> nodeIds)? network,TResult Function( VeilidConfig config)? config,TResult Function( List<String> deadRoutes, List<String> deadRemoteRoutes)? routeChange,TResult Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value)? valueChange,required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case VeilidLog() when log != null:
|
case VeilidLog() when log != null:
|
||||||
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage() when appMessage != null:
|
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage() when appMessage != null:
|
||||||
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall() when appCall != null:
|
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall() when appCall != null:
|
||||||
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment() when attachment != null:
|
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment() when attachment != null:
|
||||||
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork() when network != null:
|
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork() when network != null:
|
||||||
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers);case VeilidUpdateConfig() when config != null:
|
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers,_that.nodeIds);case VeilidUpdateConfig() when config != null:
|
||||||
return config(_that.config);case VeilidUpdateRouteChange() when routeChange != null:
|
return config(_that.config);case VeilidUpdateRouteChange() when routeChange != null:
|
||||||
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange() when valueChange != null:
|
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange() when valueChange != null:
|
||||||
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);case _:
|
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);case _:
|
||||||
|
|
@ -2858,14 +2858,14 @@ return valueChange(_that.key,_that.subkeys,_that.count,_that.value);case _:
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log,required TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId) appMessage,required TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId) appCall,required TResult Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime) attachment,required TResult Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers) network,required TResult Function( VeilidConfig config) config,required TResult Function( List<String> deadRoutes, List<String> deadRemoteRoutes) routeChange,required TResult Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value) valueChange,}) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>({required TResult Function( VeilidLogLevel logLevel, String message, String? backtrace) log,required TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId) appMessage,required TResult Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId) appCall,required TResult Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime) attachment,required TResult Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers, List<NodeId> nodeIds) network,required TResult Function( VeilidConfig config) config,required TResult Function( List<String> deadRoutes, List<String> deadRemoteRoutes) routeChange,required TResult Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value) valueChange,}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case VeilidLog():
|
case VeilidLog():
|
||||||
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage():
|
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage():
|
||||||
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall():
|
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall():
|
||||||
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment():
|
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment():
|
||||||
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork():
|
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork():
|
||||||
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers);case VeilidUpdateConfig():
|
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers,_that.nodeIds);case VeilidUpdateConfig():
|
||||||
return config(_that.config);case VeilidUpdateRouteChange():
|
return config(_that.config);case VeilidUpdateRouteChange():
|
||||||
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange():
|
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange():
|
||||||
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);}
|
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);}
|
||||||
|
|
@ -2882,14 +2882,14 @@ return valueChange(_that.key,_that.subkeys,_that.count,_that.value);}
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log,TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId)? appMessage,TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId)? appCall,TResult? Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime)? attachment,TResult? Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers)? network,TResult? Function( VeilidConfig config)? config,TResult? Function( List<String> deadRoutes, List<String> deadRemoteRoutes)? routeChange,TResult? Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value)? valueChange,}) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>({TResult? Function( VeilidLogLevel logLevel, String message, String? backtrace)? log,TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, PublicKey? sender, String? routeId)? appMessage,TResult? Function(@Uint8ListJsonConverter.jsIsArray() Uint8List message, String callId, PublicKey? sender, String? routeId)? appCall,TResult? Function( AttachmentState state, bool publicInternetReady, bool localNetworkReady, TimestampDuration uptime, TimestampDuration? attachedUptime)? attachment,TResult? Function( bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers, List<NodeId> nodeIds)? network,TResult? Function( VeilidConfig config)? config,TResult? Function( List<String> deadRoutes, List<String> deadRemoteRoutes)? routeChange,TResult? Function( RecordKey key, List<ValueSubkeyRange> subkeys, int count, ValueData? value)? valueChange,}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case VeilidLog() when log != null:
|
case VeilidLog() when log != null:
|
||||||
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage() when appMessage != null:
|
return log(_that.logLevel,_that.message,_that.backtrace);case VeilidAppMessage() when appMessage != null:
|
||||||
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall() when appCall != null:
|
return appMessage(_that.message,_that.sender,_that.routeId);case VeilidAppCall() when appCall != null:
|
||||||
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment() when attachment != null:
|
return appCall(_that.message,_that.callId,_that.sender,_that.routeId);case VeilidUpdateAttachment() when attachment != null:
|
||||||
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork() when network != null:
|
return attachment(_that.state,_that.publicInternetReady,_that.localNetworkReady,_that.uptime,_that.attachedUptime);case VeilidUpdateNetwork() when network != null:
|
||||||
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers);case VeilidUpdateConfig() when config != null:
|
return network(_that.started,_that.bpsDown,_that.bpsUp,_that.peers,_that.nodeIds);case VeilidUpdateConfig() when config != null:
|
||||||
return config(_that.config);case VeilidUpdateRouteChange() when routeChange != null:
|
return config(_that.config);case VeilidUpdateRouteChange() when routeChange != null:
|
||||||
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange() when valueChange != null:
|
return routeChange(_that.deadRoutes,_that.deadRemoteRoutes);case VeilidUpdateValueChange() when valueChange != null:
|
||||||
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);case _:
|
return valueChange(_that.key,_that.subkeys,_that.count,_that.value);case _:
|
||||||
|
|
@ -3218,7 +3218,7 @@ as TimestampDuration?,
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class VeilidUpdateNetwork implements VeilidUpdate {
|
class VeilidUpdateNetwork implements VeilidUpdate {
|
||||||
const VeilidUpdateNetwork({required this.started, required this.bpsDown, required this.bpsUp, required final List<PeerTableData> peers, final String? $type}): _peers = peers,$type = $type ?? 'Network';
|
const VeilidUpdateNetwork({required this.started, required this.bpsDown, required this.bpsUp, required final List<PeerTableData> peers, required final List<NodeId> nodeIds, final String? $type}): _peers = peers,_nodeIds = nodeIds,$type = $type ?? 'Network';
|
||||||
factory VeilidUpdateNetwork.fromJson(Map<String, dynamic> json) => _$VeilidUpdateNetworkFromJson(json);
|
factory VeilidUpdateNetwork.fromJson(Map<String, dynamic> json) => _$VeilidUpdateNetworkFromJson(json);
|
||||||
|
|
||||||
final bool started;
|
final bool started;
|
||||||
|
|
@ -3231,6 +3231,13 @@ class VeilidUpdateNetwork implements VeilidUpdate {
|
||||||
return EqualUnmodifiableListView(_peers);
|
return EqualUnmodifiableListView(_peers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<NodeId> _nodeIds;
|
||||||
|
List<NodeId> get nodeIds {
|
||||||
|
if (_nodeIds is EqualUnmodifiableListView) return _nodeIds;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_nodeIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@JsonKey(name: 'kind')
|
@JsonKey(name: 'kind')
|
||||||
final String $type;
|
final String $type;
|
||||||
|
|
@ -3249,16 +3256,16 @@ Map<String, dynamic> toJson() {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is VeilidUpdateNetwork&&(identical(other.started, started) || other.started == started)&&(identical(other.bpsDown, bpsDown) || other.bpsDown == bpsDown)&&(identical(other.bpsUp, bpsUp) || other.bpsUp == bpsUp)&&const DeepCollectionEquality().equals(other._peers, _peers));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is VeilidUpdateNetwork&&(identical(other.started, started) || other.started == started)&&(identical(other.bpsDown, bpsDown) || other.bpsDown == bpsDown)&&(identical(other.bpsUp, bpsUp) || other.bpsUp == bpsUp)&&const DeepCollectionEquality().equals(other._peers, _peers)&&const DeepCollectionEquality().equals(other._nodeIds, _nodeIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,started,bpsDown,bpsUp,const DeepCollectionEquality().hash(_peers));
|
int get hashCode => Object.hash(runtimeType,started,bpsDown,bpsUp,const DeepCollectionEquality().hash(_peers),const DeepCollectionEquality().hash(_nodeIds));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'VeilidUpdate.network(started: $started, bpsDown: $bpsDown, bpsUp: $bpsUp, peers: $peers)';
|
return 'VeilidUpdate.network(started: $started, bpsDown: $bpsDown, bpsUp: $bpsUp, peers: $peers, nodeIds: $nodeIds)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3269,7 +3276,7 @@ abstract mixin class $VeilidUpdateNetworkCopyWith<$Res> implements $VeilidUpdate
|
||||||
factory $VeilidUpdateNetworkCopyWith(VeilidUpdateNetwork value, $Res Function(VeilidUpdateNetwork) _then) = _$VeilidUpdateNetworkCopyWithImpl;
|
factory $VeilidUpdateNetworkCopyWith(VeilidUpdateNetwork value, $Res Function(VeilidUpdateNetwork) _then) = _$VeilidUpdateNetworkCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers
|
bool started, BigInt bpsDown, BigInt bpsUp, List<PeerTableData> peers, List<NodeId> nodeIds
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3286,13 +3293,14 @@ class _$VeilidUpdateNetworkCopyWithImpl<$Res>
|
||||||
|
|
||||||
/// Create a copy of VeilidUpdate
|
/// Create a copy of VeilidUpdate
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') $Res call({Object? started = null,Object? bpsDown = null,Object? bpsUp = null,Object? peers = null,}) {
|
@pragma('vm:prefer-inline') $Res call({Object? started = null,Object? bpsDown = null,Object? bpsUp = null,Object? peers = null,Object? nodeIds = null,}) {
|
||||||
return _then(VeilidUpdateNetwork(
|
return _then(VeilidUpdateNetwork(
|
||||||
started: null == started ? _self.started : started // ignore: cast_nullable_to_non_nullable
|
started: null == started ? _self.started : started // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,bpsDown: null == bpsDown ? _self.bpsDown : bpsDown // ignore: cast_nullable_to_non_nullable
|
as bool,bpsDown: null == bpsDown ? _self.bpsDown : bpsDown // ignore: cast_nullable_to_non_nullable
|
||||||
as BigInt,bpsUp: null == bpsUp ? _self.bpsUp : bpsUp // ignore: cast_nullable_to_non_nullable
|
as BigInt,bpsUp: null == bpsUp ? _self.bpsUp : bpsUp // ignore: cast_nullable_to_non_nullable
|
||||||
as BigInt,peers: null == peers ? _self._peers : peers // ignore: cast_nullable_to_non_nullable
|
as BigInt,peers: null == peers ? _self._peers : peers // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PeerTableData>,
|
as List<PeerTableData>,nodeIds: null == nodeIds ? _self._nodeIds : nodeIds // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<NodeId>,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ Map<String, dynamic> _$PeerStatsToJson(_PeerStats instance) =>
|
||||||
_PeerTableData _$PeerTableDataFromJson(Map<String, dynamic> json) =>
|
_PeerTableData _$PeerTableDataFromJson(Map<String, dynamic> json) =>
|
||||||
_PeerTableData(
|
_PeerTableData(
|
||||||
nodeIds: (json['node_ids'] as List<dynamic>)
|
nodeIds: (json['node_ids'] as List<dynamic>)
|
||||||
.map(Typed<BarePublicKey>.fromJson)
|
.map(Typed<BareNodeId>.fromJson)
|
||||||
.toList(),
|
.toList(),
|
||||||
peerAddress: json['peer_address'] as String,
|
peerAddress: json['peer_address'] as String,
|
||||||
peerStats: PeerStats.fromJson(json['peer_stats']),
|
peerStats: PeerStats.fromJson(json['peer_stats']),
|
||||||
|
|
@ -299,6 +299,9 @@ VeilidUpdateNetwork _$VeilidUpdateNetworkFromJson(Map<String, dynamic> json) =>
|
||||||
peers: (json['peers'] as List<dynamic>)
|
peers: (json['peers'] as List<dynamic>)
|
||||||
.map(PeerTableData.fromJson)
|
.map(PeerTableData.fromJson)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
nodeIds: (json['node_ids'] as List<dynamic>)
|
||||||
|
.map(Typed<BareNodeId>.fromJson)
|
||||||
|
.toList(),
|
||||||
$type: json['kind'] as String?,
|
$type: json['kind'] as String?,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -309,6 +312,7 @@ Map<String, dynamic> _$VeilidUpdateNetworkToJson(
|
||||||
'bps_down': instance.bpsDown.toString(),
|
'bps_down': instance.bpsDown.toString(),
|
||||||
'bps_up': instance.bpsUp.toString(),
|
'bps_up': instance.bpsUp.toString(),
|
||||||
'peers': instance.peers.map((e) => e.toJson()).toList(),
|
'peers': instance.peers.map((e) => e.toJson()).toList(),
|
||||||
|
'node_ids': instance.nodeIds.map((e) => e.toJson()).toList(),
|
||||||
'kind': instance.$type,
|
'kind': instance.$type,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@ async def test_connect(api_connection: veilid.VeilidAPI):
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_get_public_keys(api_connection: veilid.VeilidAPI):
|
async def test_get_node_ids(api_connection: veilid.VeilidAPI):
|
||||||
state = await api_connection.get_state()
|
state = await api_connection.get_state()
|
||||||
public_keys = state.config.config.network.routing_table.public_keys
|
node_ids = state.network.node_ids
|
||||||
|
|
||||||
assert len(public_keys) >= 1
|
assert len(node_ids) >= 1
|
||||||
|
|
||||||
for public_key in public_keys:
|
for node_id in node_ids:
|
||||||
assert public_key[4] == ":"
|
assert node_id[4] == ":"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
|
||||||
2
veilid-python/uv.lock
generated
2
veilid-python/uv.lock
generated
|
|
@ -210,7 +210,7 @@ wheels = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "veilid"
|
name = "veilid"
|
||||||
version = "0.4.7"
|
version = "0.4.8"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "appdirs" },
|
{ name = "appdirs" },
|
||||||
|
|
|
||||||
|
|
@ -4758,6 +4758,13 @@
|
||||||
"description": "The total number of bytes per second used by Veilid currently in the upload direction.",
|
"description": "The total number of bytes per second used by Veilid currently in the upload direction.",
|
||||||
"$ref": "#/$defs/ByteCount"
|
"$ref": "#/$defs/ByteCount"
|
||||||
},
|
},
|
||||||
|
"node_ids": {
|
||||||
|
"description": "The list of node ids for this node",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"peers": {
|
"peers": {
|
||||||
"description": "The list of most recently accessed peers.\nThis is not an active connection table, nor is representative of the entire routing table.",
|
"description": "The list of most recently accessed peers.\nThis is not an active connection table, nor is representative of the entire routing table.",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
|
@ -4774,7 +4781,8 @@
|
||||||
"started",
|
"started",
|
||||||
"bps_down",
|
"bps_down",
|
||||||
"bps_up",
|
"bps_up",
|
||||||
"peers"
|
"peers",
|
||||||
|
"node_ids"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"VeilidUpdate": {
|
"VeilidUpdate": {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from .types import (
|
||||||
BareRouteId,
|
BareRouteId,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
TimestampDuration,
|
TimestampDuration,
|
||||||
PublicKey,
|
NodeId,
|
||||||
RecordKey,
|
RecordKey,
|
||||||
ValueData,
|
ValueData,
|
||||||
ValueSubkey,
|
ValueSubkey,
|
||||||
|
|
@ -382,11 +382,11 @@ class PeerStats:
|
||||||
|
|
||||||
|
|
||||||
class PeerTableData:
|
class PeerTableData:
|
||||||
node_ids: list[str]
|
node_ids: list[NodeId]
|
||||||
peer_address: str
|
peer_address: str
|
||||||
peer_stats: PeerStats
|
peer_stats: PeerStats
|
||||||
|
|
||||||
def __init__(self, node_ids: list[str], peer_address: str, peer_stats: PeerStats):
|
def __init__(self, node_ids: list[NodeId], peer_address: str, peer_stats: PeerStats):
|
||||||
self.node_ids = node_ids
|
self.node_ids = node_ids
|
||||||
self.peer_address = peer_address
|
self.peer_address = peer_address
|
||||||
self.peer_stats = peer_stats
|
self.peer_stats = peer_stats
|
||||||
|
|
@ -394,7 +394,9 @@ class PeerTableData:
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, j: dict) -> Self:
|
def from_json(cls, j: dict) -> Self:
|
||||||
"""JSON object hook"""
|
"""JSON object hook"""
|
||||||
return cls(j["node_ids"], j["peer_address"], PeerStats.from_json(j["peer_stats"]))
|
return cls([NodeId(node_id) for node_id in j["node_ids"]],
|
||||||
|
j["peer_address"],
|
||||||
|
PeerStats.from_json(j["peer_stats"]))
|
||||||
|
|
||||||
def to_json(self) -> dict:
|
def to_json(self) -> dict:
|
||||||
return self.__dict__
|
return self.__dict__
|
||||||
|
|
@ -405,6 +407,7 @@ class VeilidStateNetwork:
|
||||||
bps_down: ByteCount
|
bps_down: ByteCount
|
||||||
bps_up: ByteCount
|
bps_up: ByteCount
|
||||||
peers: list[PeerTableData]
|
peers: list[PeerTableData]
|
||||||
|
node_ids: list[NodeId]
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -412,11 +415,13 @@ class VeilidStateNetwork:
|
||||||
bps_down: ByteCount,
|
bps_down: ByteCount,
|
||||||
bps_up: ByteCount,
|
bps_up: ByteCount,
|
||||||
peers: list[PeerTableData],
|
peers: list[PeerTableData],
|
||||||
|
node_ids: list[NodeId],
|
||||||
):
|
):
|
||||||
self.started = started
|
self.started = started
|
||||||
self.bps_down = bps_down
|
self.bps_down = bps_down
|
||||||
self.bps_up = bps_up
|
self.bps_up = bps_up
|
||||||
self.peers = peers
|
self.peers = peers
|
||||||
|
self.node_ids = node_ids
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, j: dict) -> Self:
|
def from_json(cls, j: dict) -> Self:
|
||||||
|
|
@ -426,6 +431,7 @@ class VeilidStateNetwork:
|
||||||
ByteCount(j["bps_down"]),
|
ByteCount(j["bps_down"]),
|
||||||
ByteCount(j["bps_up"]),
|
ByteCount(j["bps_up"]),
|
||||||
[PeerTableData.from_json(peer) for peer in j["peers"]],
|
[PeerTableData.from_json(peer) for peer in j["peers"]],
|
||||||
|
[NodeId(node_id) for node_id in j["node_ids"]],
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_json(self) -> dict:
|
def to_json(self) -> dict:
|
||||||
|
|
@ -495,11 +501,11 @@ class VeilidLog:
|
||||||
|
|
||||||
|
|
||||||
class VeilidAppMessage:
|
class VeilidAppMessage:
|
||||||
sender: Optional[PublicKey]
|
sender: Optional[NodeId]
|
||||||
route_id: Optional[BareRouteId]
|
route_id: Optional[BareRouteId]
|
||||||
message: bytes
|
message: bytes
|
||||||
|
|
||||||
def __init__(self, sender: Optional[PublicKey], route_id: Optional[BareRouteId], message: bytes):
|
def __init__(self, sender: Optional[NodeId], route_id: Optional[BareRouteId], message: bytes):
|
||||||
self.sender = sender
|
self.sender = sender
|
||||||
self.route_id = route_id
|
self.route_id = route_id
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
@ -508,7 +514,7 @@ class VeilidAppMessage:
|
||||||
def from_json(cls, j: dict) -> Self:
|
def from_json(cls, j: dict) -> Self:
|
||||||
"""JSON object hook"""
|
"""JSON object hook"""
|
||||||
return cls(
|
return cls(
|
||||||
None if j["sender"] is None else PublicKey(j["sender"]),
|
None if j["sender"] is None else NodeId(j["sender"]),
|
||||||
None if j["route_id"] is None else BareRouteId(j["route_id"]),
|
None if j["route_id"] is None else BareRouteId(j["route_id"]),
|
||||||
urlsafe_b64decode_no_pad(j["message"]),
|
urlsafe_b64decode_no_pad(j["message"]),
|
||||||
)
|
)
|
||||||
|
|
@ -518,12 +524,12 @@ class VeilidAppMessage:
|
||||||
|
|
||||||
|
|
||||||
class VeilidAppCall:
|
class VeilidAppCall:
|
||||||
sender: Optional[PublicKey]
|
sender: Optional[NodeId]
|
||||||
route_id: Optional[BareRouteId]
|
route_id: Optional[BareRouteId]
|
||||||
message: bytes
|
message: bytes
|
||||||
call_id: OperationId
|
call_id: OperationId
|
||||||
|
|
||||||
def __init__(self, sender: Optional[PublicKey], route_id: Optional[BareRouteId], message: bytes, call_id: OperationId):
|
def __init__(self, sender: Optional[NodeId], route_id: Optional[BareRouteId], message: bytes, call_id: OperationId):
|
||||||
self.sender = sender
|
self.sender = sender
|
||||||
self.route_id = route_id
|
self.route_id = route_id
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
@ -533,7 +539,7 @@ class VeilidAppCall:
|
||||||
def from_json(cls, j: dict) -> Self:
|
def from_json(cls, j: dict) -> Self:
|
||||||
"""JSON object hook"""
|
"""JSON object hook"""
|
||||||
return cls(
|
return cls(
|
||||||
None if j["sender"] is None else PublicKey(j["sender"]),
|
None if j["sender"] is None else NodeId(j["sender"]),
|
||||||
None if j["route_id"] is None else BareRouteId(j["route_id"]),
|
None if j["route_id"] is None else BareRouteId(j["route_id"]),
|
||||||
urlsafe_b64decode_no_pad(j["message"]),
|
urlsafe_b64decode_no_pad(j["message"]),
|
||||||
OperationId(j["call_id"]),
|
OperationId(j["call_id"]),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue