Merge branch 'veilidchat-work' into 'main'

VeilidChat progress fixes

See merge request veilid/veilid!126
This commit is contained in:
Christien Rioux 2023-08-18 05:06:53 +00:00
commit 242f3c0a38
29 changed files with 858 additions and 532 deletions

View File

@ -325,4 +325,11 @@ impl Crypto {
}, },
) )
} }
pub(crate) fn validate_crypto_kind(kind: CryptoKind) -> VeilidAPIResult<()> {
if !VALID_CRYPTO_KINDS.contains(&kind) {
apibail_generic!("invalid crypto kind");
}
Ok(())
}
} }

View File

@ -361,7 +361,7 @@ impl AddressFilter {
Entry::Occupied(mut o) => { Entry::Occupied(mut o) => {
let cnt = o.get_mut(); let cnt = o.get_mut();
assert!(*cnt > 0); assert!(*cnt > 0);
if *cnt == 0 { if *cnt == 1 {
inner.conn_count_by_ip4.remove(&v4); inner.conn_count_by_ip4.remove(&v4);
} else { } else {
*cnt -= 1; *cnt -= 1;
@ -377,7 +377,7 @@ impl AddressFilter {
Entry::Occupied(mut o) => { Entry::Occupied(mut o) => {
let cnt = o.get_mut(); let cnt = o.get_mut();
assert!(*cnt > 0); assert!(*cnt > 0);
if *cnt == 0 { if *cnt == 1 {
inner.conn_count_by_ip6_prefix.remove(&v6); inner.conn_count_by_ip6_prefix.remove(&v6);
} else { } else {
*cnt -= 1; *cnt -= 1;

View File

@ -164,9 +164,9 @@ impl Network {
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
fn find_available_udp_port(&self) -> EyreResult<u16> { fn find_available_udp_port(&self, start_port: u16) -> EyreResult<u16> {
// If the address is empty, iterate ports until we find one we can use. // If the address is empty, iterate ports until we find one we can use.
let mut udp_port = 5150u16; let mut udp_port = start_port;
loop { loop {
if BAD_PORTS.contains(&udp_port) { if BAD_PORTS.contains(&udp_port) {
continue; continue;
@ -182,9 +182,9 @@ impl Network {
Ok(udp_port) Ok(udp_port)
} }
fn find_available_tcp_port(&self) -> EyreResult<u16> { fn find_available_tcp_port(&self, start_port: u16) -> EyreResult<u16> {
// If the address is empty, iterate ports until we find one we can use. // If the address is empty, iterate ports until we find one we can use.
let mut tcp_port = 5150u16; let mut tcp_port = start_port;
loop { loop {
if BAD_PORTS.contains(&tcp_port) { if BAD_PORTS.contains(&tcp_port) {
continue; continue;
@ -203,7 +203,7 @@ impl Network {
async fn allocate_udp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> { async fn allocate_udp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> {
if listen_address.is_empty() { if listen_address.is_empty() {
// If listen address is empty, find us a port iteratively // If listen address is empty, find us a port iteratively
let port = self.find_available_udp_port()?; let port = self.find_available_udp_port(5150)?;
let ip_addrs = vec![ let ip_addrs = vec![
IpAddr::V4(Ipv4Addr::UNSPECIFIED), IpAddr::V4(Ipv4Addr::UNSPECIFIED),
IpAddr::V6(Ipv6Addr::UNSPECIFIED), IpAddr::V6(Ipv6Addr::UNSPECIFIED),
@ -218,9 +218,7 @@ impl Network {
bail!("No valid listen address: {}", listen_address); bail!("No valid listen address: {}", listen_address);
} }
let port = sockaddrs[0].port(); let port = sockaddrs[0].port();
if !self.bind_first_udp_port(port) {
bail!("Could not find free udp port to listen on");
}
Ok((port, sockaddrs.iter().map(|s| s.ip()).collect())) Ok((port, sockaddrs.iter().map(|s| s.ip()).collect()))
} }
} }
@ -228,7 +226,7 @@ impl Network {
async fn allocate_tcp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> { async fn allocate_tcp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> {
if listen_address.is_empty() { if listen_address.is_empty() {
// If listen address is empty, find us a port iteratively // If listen address is empty, find us a port iteratively
let port = self.find_available_tcp_port()?; let port = self.find_available_tcp_port(5150)?;
let ip_addrs = vec![ let ip_addrs = vec![
IpAddr::V4(Ipv4Addr::UNSPECIFIED), IpAddr::V4(Ipv4Addr::UNSPECIFIED),
IpAddr::V6(Ipv6Addr::UNSPECIFIED), IpAddr::V6(Ipv6Addr::UNSPECIFIED),

View File

@ -13,6 +13,9 @@ impl RoutingTable {
"Not finding closest peers because our network class is still invalid", "Not finding closest peers because our network class is still invalid",
); );
} }
if Crypto::validate_crypto_kind(key.kind).is_err() {
return NetworkResult::invalid_message("invalid crypto kind");
}
// find N nodes closest to the target node in our routing table // find N nodes closest to the target node in our routing table
let own_peer_info = self.get_own_peer_info(RoutingDomain::PublicInternet); let own_peer_info = self.get_own_peer_info(RoutingDomain::PublicInternet);
@ -46,7 +49,7 @@ impl RoutingTable {
}; };
let own_peer_info = self.get_own_peer_info(RoutingDomain::PublicInternet); let own_peer_info = self.get_own_peer_info(RoutingDomain::PublicInternet);
let closest_nodes = self.find_closest_nodes( let closest_nodes = match self.find_closest_nodes(
node_count, node_count,
key, key,
filters, filters,
@ -54,7 +57,13 @@ impl RoutingTable {
|rti, entry| { |rti, entry| {
rti.transform_to_peer_info(RoutingDomain::PublicInternet, &own_peer_info, entry) rti.transform_to_peer_info(RoutingDomain::PublicInternet, &own_peer_info, entry)
}, },
); ) {
Ok(v) => v,
Err(e) => {
error!("failed to find closest nodes for key {}: {}", key, e);
return NetworkResult::invalid_message("failed to find closest nodes for key");
}
};
NetworkResult::value(closest_nodes) NetworkResult::value(closest_nodes)
} }
@ -117,7 +126,7 @@ impl RoutingTable {
}; };
// //
let closest_nodes = self.find_closest_nodes( let closest_nodes = match self.find_closest_nodes(
node_count, node_count,
key, key,
filters, filters,
@ -127,7 +136,13 @@ impl RoutingTable {
e.make_peer_info(RoutingDomain::PublicInternet).unwrap() e.make_peer_info(RoutingDomain::PublicInternet).unwrap()
}) })
}, },
); ) {
Ok(v) => v,
Err(e) => {
error!("failed to find closest nodes for key {}: {}", key, e);
return NetworkResult::invalid_message("failed to find closest nodes for key");
}
};
// Validate peers returned are, in fact, closer to the key than the node we sent this to // Validate peers returned are, in fact, closer to the key than the node we sent this to
// This same test is used on the other side so we vet things here // This same test is used on the other side so we vet things here

View File

@ -1012,7 +1012,7 @@ impl RoutingTable {
node_id: TypedKey, node_id: TypedKey,
filters: VecDeque<RoutingTableEntryFilter>, filters: VecDeque<RoutingTableEntryFilter>,
transform: T, transform: T,
) -> Vec<O> ) -> VeilidAPIResult<Vec<O>>
where where
T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O + Send, T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O + Send,
{ {

View File

@ -1162,7 +1162,7 @@ impl RoutingTableInner {
node_id: TypedKey, node_id: TypedKey,
mut filters: VecDeque<RoutingTableEntryFilter>, mut filters: VecDeque<RoutingTableEntryFilter>,
transform: T, transform: T,
) -> Vec<O> ) -> VeilidAPIResult<Vec<O>>
where where
T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O, T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O,
{ {
@ -1170,7 +1170,9 @@ impl RoutingTableInner {
// Get the crypto kind // Get the crypto kind
let crypto_kind = node_id.kind; let crypto_kind = node_id.kind;
let vcrypto = self.unlocked_inner.crypto().get(crypto_kind).unwrap(); let Some(vcrypto) = self.unlocked_inner.crypto().get(crypto_kind) else {
apibail_generic!("invalid crypto kind");
};
// Filter to ensure entries support the crypto kind in use // Filter to ensure entries support the crypto kind in use
let filter = Box::new( let filter = Box::new(
@ -1236,7 +1238,7 @@ impl RoutingTableInner {
let out = let out =
self.find_peers_with_sort_and_filter(node_count, cur_ts, filters, sort, transform); self.find_peers_with_sort_and_filter(node_count, cur_ts, filters, sort, transform);
log_rtab!(">> find_closest_nodes: node count = {}", out.len()); log_rtab!(">> find_closest_nodes: node count = {}", out.len());
out Ok(out)
} }
pub fn sort_and_clean_closest_noderefs( pub fn sort_and_clean_closest_noderefs(

View File

@ -208,7 +208,7 @@ where
} }
} }
fn init_closest_nodes(self: Arc<Self>) { fn init_closest_nodes(self: Arc<Self>) -> Result<(), RPCError> {
// Get the 'node_count' closest nodes to the key out of our routing table // Get the 'node_count' closest nodes to the key out of our routing table
let closest_nodes = { let closest_nodes = {
let routing_table = self.routing_table.clone(); let routing_table = self.routing_table.clone();
@ -247,11 +247,14 @@ where
NodeRef::new(routing_table.clone(), v.unwrap().clone(), None) NodeRef::new(routing_table.clone(), v.unwrap().clone(), None)
}; };
routing_table.find_closest_nodes(self.node_count, self.node_id, filters, transform) routing_table
.find_closest_nodes(self.node_count, self.node_id, filters, transform)
.map_err(RPCError::invalid_format)?
}; };
let mut ctx = self.context.lock(); let mut ctx = self.context.lock();
ctx.closest_nodes = closest_nodes; ctx.closest_nodes = closest_nodes;
Ok(())
} }
pub async fn run(self: Arc<Self>) -> TimeoutOr<Result<Option<R>, RPCError>> { pub async fn run(self: Arc<Self>) -> TimeoutOr<Result<Option<R>, RPCError>> {
@ -264,7 +267,9 @@ where
}; };
// Initialize closest nodes list // Initialize closest nodes list
self.clone().init_closest_nodes(); if let Err(e) = self.clone().init_closest_nodes() {
return TimeoutOr::value(Err(e));
}
// Do a quick check to see if we're already done // Do a quick check to see if we're already done
if self.clone().evaluate_done() { if self.clone().evaluate_done() {
@ -283,7 +288,11 @@ where
} }
// Wait for them to complete // Wait for them to complete
timeout(timeout_ms, async { timeout(timeout_ms, async {
while let Some(_) = unord.next().await {} while let Some(_) = unord.next().await {
if self.clone().evaluate_done() {
break;
}
}
}) })
.await .await
.into_timeout_or() .into_timeout_or()

View File

@ -13,7 +13,6 @@ struct OutboundGetValueContext {
} }
impl StorageManager { impl StorageManager {
/// Perform a 'get value' query on the network /// Perform a 'get value' query on the network
pub async fn outbound_get_value( pub async fn outbound_get_value(
&self, &self,
@ -74,15 +73,14 @@ impl StorageManager {
if let Some(descriptor) = gva.answer.descriptor { if let Some(descriptor) = gva.answer.descriptor {
let mut ctx = context.lock(); let mut ctx = context.lock();
if ctx.descriptor.is_none() && ctx.schema.is_none() { if ctx.descriptor.is_none() && ctx.schema.is_none() {
ctx.schema = ctx.schema = Some(descriptor.schema().map_err(RPCError::invalid_format)?);
Some(descriptor.schema().map_err(RPCError::invalid_format)?);
ctx.descriptor = Some(descriptor); ctx.descriptor = Some(descriptor);
} }
} }
// Keep the value if we got one and it is newer and it passes schema validation // Keep the value if we got one and it is newer and it passes schema validation
if let Some(value) = gva.answer.value { if let Some(value) = gva.answer.value {
log_stor!(debug "Got value back: len={}", value.value_data().data().len()); log_stor!(debug "Got value back: len={} seq={}", value.value_data().data().len(), value.value_data().seq());
let mut ctx = context.lock(); let mut ctx = context.lock();
// Ensure we have a schema and descriptor // Ensure we have a schema and descriptor
@ -126,8 +124,7 @@ impl StorageManager {
} else { } else {
// If the sequence number is older, ignore it // If the sequence number is older, ignore it
} }
} } else {
else {
// If we have no prior value, keep it // If we have no prior value, keep it
ctx.value = Some(value); ctx.value = Some(value);
// One node has shown us this value so far // One node has shown us this value so far
@ -136,7 +133,7 @@ impl StorageManager {
} }
// Return peers if we have some // Return peers if we have some
#[cfg(feature="network-result-extra")] #[cfg(feature = "network-result-extra")]
log_stor!(debug "GetValue fanout call returned peers {}", gva.answer.peers.len()); log_stor!(debug "GetValue fanout call returned peers {}", gva.answer.peers.len());
Ok(Some(gva.answer.peers)) Ok(Some(gva.answer.peers))
@ -147,7 +144,8 @@ impl StorageManager {
let check_done = |_closest_nodes: &[NodeRef]| { let check_done = |_closest_nodes: &[NodeRef]| {
// If we have reached sufficient consensus, return done // If we have reached sufficient consensus, return done
let ctx = context.lock(); let ctx = context.lock();
if ctx.value.is_some() && ctx.descriptor.is_some() && ctx.value_count >= consensus_count { if ctx.value.is_some() && ctx.descriptor.is_some() && ctx.value_count >= consensus_count
{
return Some(()); return Some(());
} }
None None
@ -167,14 +165,31 @@ impl StorageManager {
match fanout_call.run().await { match fanout_call.run().await {
// If we don't finish in the timeout (too much time passed checking for consensus) // If we don't finish in the timeout (too much time passed checking for consensus)
TimeoutOr::Timeout | TimeoutOr::Timeout => {
log_stor!(debug "GetValue Fanout Timeout");
// Return the best answer we've got
let ctx = context.lock();
Ok(SubkeyResult {
value: ctx.value.clone(),
descriptor: ctx.descriptor.clone(),
})
}
// If we finished with consensus (enough nodes returning the same value) // If we finished with consensus (enough nodes returning the same value)
TimeoutOr::Value(Ok(Some(()))) | TimeoutOr::Value(Ok(Some(()))) => {
log_stor!(debug "GetValue Fanout Consensus");
// Return the best answer we've got
let ctx = context.lock();
Ok(SubkeyResult {
value: ctx.value.clone(),
descriptor: ctx.descriptor.clone(),
})
}
// If we finished without consensus (ran out of nodes before getting consensus) // If we finished without consensus (ran out of nodes before getting consensus)
TimeoutOr::Value(Ok(None)) => { TimeoutOr::Value(Ok(None)) => {
// Return the best answer we've got // Return the best answer we've got
let ctx = context.lock(); let ctx = context.lock();
Ok(SubkeyResult{ log_stor!(debug "GetValue Fanout No Consensus: {}", ctx.value_count);
Ok(SubkeyResult {
value: ctx.value.clone(), value: ctx.value.clone(),
descriptor: ctx.descriptor.clone(), descriptor: ctx.descriptor.clone(),
}) })
@ -182,22 +197,31 @@ impl StorageManager {
// Failed // Failed
TimeoutOr::Value(Err(e)) => { TimeoutOr::Value(Err(e)) => {
// If we finished with an error, return that // If we finished with an error, return that
log_stor!(debug "GetValue Fanout Error: {}", e);
Err(e.into()) Err(e.into())
} }
} }
} }
/// Handle a recieved 'Get Value' query /// Handle a recieved 'Get Value' query
pub async fn inbound_get_value(&self, key: TypedKey, subkey: ValueSubkey, want_descriptor: bool) -> VeilidAPIResult<NetworkResult<SubkeyResult>> { pub async fn inbound_get_value(
&self,
key: TypedKey,
subkey: ValueSubkey,
want_descriptor: bool,
) -> VeilidAPIResult<NetworkResult<SubkeyResult>> {
let mut inner = self.lock().await?; let mut inner = self.lock().await?;
let res = match inner.handle_get_remote_value(key, subkey, want_descriptor).await { let res = match inner
.handle_get_remote_value(key, subkey, want_descriptor)
.await
{
Ok(res) => res, Ok(res) => res,
Err(VeilidAPIError::Internal { message }) => { Err(VeilidAPIError::Internal { message }) => {
apibail_internal!(message); apibail_internal!(message);
}, }
Err(e) => { Err(e) => {
return Ok(NetworkResult::invalid_message(e)); return Ok(NetworkResult::invalid_message(e));
}, }
}; };
Ok(NetworkResult::value(res)) Ok(NetworkResult::value(res))
} }

View File

@ -18,6 +18,7 @@ use storage_manager_inner::*;
pub use types::*; pub use types::*;
use super::*; use super::*;
use network_manager::*;
use routing_table::*; use routing_table::*;
use rpc_processor::*; use rpc_processor::*;
@ -27,6 +28,8 @@ const MAX_SUBKEY_SIZE: usize = ValueData::MAX_LEN;
const MAX_RECORD_DATA_SIZE: usize = 1_048_576; const MAX_RECORD_DATA_SIZE: usize = 1_048_576;
/// Frequency to flush record stores to disk /// Frequency to flush record stores to disk
const FLUSH_RECORD_STORES_INTERVAL_SECS: u32 = 1; const FLUSH_RECORD_STORES_INTERVAL_SECS: u32 = 1;
/// Frequency to check for offline subkeys writes to send to the network
const OFFLINE_SUBKEY_WRITES_INTERVAL_SECS: u32 = 1;
struct StorageManagerUnlockedInner { struct StorageManagerUnlockedInner {
config: VeilidConfig, config: VeilidConfig,
@ -37,6 +40,7 @@ struct StorageManagerUnlockedInner {
// Background processes // Background processes
flush_record_stores_task: TickTask<EyreReport>, flush_record_stores_task: TickTask<EyreReport>,
offline_subkey_writes_task: TickTask<EyreReport>,
} }
#[derive(Clone)] #[derive(Clone)]
@ -59,6 +63,7 @@ impl StorageManager {
#[cfg(feature = "unstable-blockstore")] #[cfg(feature = "unstable-blockstore")]
block_store, block_store,
flush_record_stores_task: TickTask::new(FLUSH_RECORD_STORES_INTERVAL_SECS), flush_record_stores_task: TickTask::new(FLUSH_RECORD_STORES_INTERVAL_SECS),
offline_subkey_writes_task: TickTask::new(OFFLINE_SUBKEY_WRITES_INTERVAL_SECS),
} }
} }
fn new_inner(unlocked_inner: Arc<StorageManagerUnlockedInner>) -> StorageManagerInner { fn new_inner(unlocked_inner: Arc<StorageManagerUnlockedInner>) -> StorageManagerInner {
@ -127,6 +132,40 @@ impl StorageManager {
Ok(inner) Ok(inner)
} }
fn online_writes_ready_inner(inner: &StorageManagerInner) -> Option<RPCProcessor> {
if let Some(rpc_processor) = {
inner.rpc_processor.clone()
} {
if let Some(network_class) = rpc_processor
.routing_table()
.get_network_class(RoutingDomain::PublicInternet)
{
// If our PublicInternet network class is valid we're ready to talk
if network_class != NetworkClass::Invalid {
Some(rpc_processor)
} else {
None
}
} else {
// If we haven't gotten a network class yet we shouldnt try to use the DHT
None
}
} else {
// If we aren't attached, we won't have an rpc processor
None
}
}
async fn online_writes_ready(&self) -> EyreResult<Option<RPCProcessor>> {
let inner = self.lock().await?;
return Ok(Self::online_writes_ready_inner(&*inner));
}
async fn has_offline_subkey_writes(&self) -> EyreResult<bool> {
let inner = self.lock().await?;
Ok(inner.offline_subkey_writes.len() != 0)
}
/// Create a local record from scratch with a new owner key, open it, and return the opened descriptor /// Create a local record from scratch with a new owner key, open it, and return the opened descriptor
pub async fn create_record( pub async fn create_record(
&self, &self,
@ -201,6 +240,17 @@ impl StorageManager {
// Reopen inner to store value we just got // Reopen inner to store value we just got
let mut inner = self.lock().await?; let mut inner = self.lock().await?;
// Check again to see if we have a local record already or not
// because waiting for the outbound_get_value action could result in the key being opened
// via some parallel process
if let Some(res) = inner
.open_existing_record(key, writer, safety_selection)
.await?
{
return Ok(res);
}
// Open the new record // Open the new record
inner inner
.open_new_record(key, writer, subkey, subkey_result, safety_selection) .open_new_record(key, writer, subkey, subkey_result, safety_selection)
@ -373,14 +423,22 @@ impl StorageManager {
)?; )?;
// Get rpc processor and drop mutex so we don't block while getting the value from the network // Get rpc processor and drop mutex so we don't block while getting the value from the network
let Some(rpc_processor) = inner.rpc_processor.clone() else { let Some(rpc_processor) = Self::online_writes_ready_inner(&inner) else {
log_stor!(debug "Writing subkey locally: {}:{} len={}", key, subkey, signed_value_data.value_data().data().len() );
// Offline, just write it locally and return immediately // Offline, just write it locally and return immediately
inner inner
.handle_set_local_value(key, subkey, signed_value_data.clone()) .handle_set_local_value(key, subkey, signed_value_data.clone())
.await?; .await?;
log_stor!(debug "Writing subkey offline: {}:{} len={}", key, subkey, signed_value_data.value_data().data().len() );
// Add to offline writes to flush // Add to offline writes to flush
inner.offline_subkey_writes.entry(key).and_modify(|x| { x.insert(subkey); } ).or_insert(ValueSubkeyRangeSet::single(subkey)); inner.offline_subkey_writes.entry(key)
.and_modify(|x| { x.subkeys.insert(subkey); } )
.or_insert(OfflineSubkeyWrite{
safety_selection,
subkeys: ValueSubkeyRangeSet::single(subkey)
});
return Ok(None) return Ok(None)
}; };

View File

@ -11,7 +11,6 @@ struct OutboundSetValueContext {
} }
impl StorageManager { impl StorageManager {
/// Perform a 'set value' query on the network /// Perform a 'set value' query on the network
pub async fn outbound_set_value( pub async fn outbound_set_value(
&self, &self,
@ -49,7 +48,6 @@ impl StorageManager {
let context = context.clone(); let context = context.clone();
let descriptor = descriptor.clone(); let descriptor = descriptor.clone();
async move { async move {
let send_descriptor = true; // xxx check if next_node needs the descriptor or not let send_descriptor = true; // xxx check if next_node needs the descriptor or not
// get most recent value to send // get most recent value to send
@ -81,6 +79,7 @@ impl StorageManager {
// Keep the value if we got one and it is newer and it passes schema validation // Keep the value if we got one and it is newer and it passes schema validation
if let Some(value) = sva.answer.value { if let Some(value) = sva.answer.value {
log_stor!(debug "Got value back: len={} seq={}", value.value_data().data().len(), value.value_data().seq());
// Validate with schema // Validate with schema
if !ctx.schema.check_subkey_value_data( if !ctx.schema.check_subkey_value_data(
@ -101,14 +100,12 @@ impl StorageManager {
// One node has shown us this value so far // One node has shown us this value so far
ctx.value_count = 1; ctx.value_count = 1;
} else { } else {
// If the sequence number is older, or an equal sequence number, // If the sequence number is older, or an equal sequence number,
// node should have not returned a value here. // node should have not returned a value here.
// Skip this node and it's closer list because it is misbehaving // Skip this node and it's closer list because it is misbehaving
return Ok(None); return Ok(None);
} }
} } else {
else
{
// It was set on this node and no newer value was found and returned, // It was set on this node and no newer value was found and returned,
// so increase our consensus count // so increase our consensus count
ctx.value_count += 1; ctx.value_count += 1;
@ -116,7 +113,7 @@ impl StorageManager {
} }
// Return peers if we have some // Return peers if we have some
#[cfg(feature="network-result-extra")] #[cfg(feature = "network-result-extra")]
log_stor!(debug "SetValue fanout call returned peers {}", sva.answer.peers.len()); log_stor!(debug "SetValue fanout call returned peers {}", sva.answer.peers.len());
Ok(Some(sva.answer.peers)) Ok(Some(sva.answer.peers))
@ -147,18 +144,30 @@ impl StorageManager {
match fanout_call.run().await { match fanout_call.run().await {
// If we don't finish in the timeout (too much time passed checking for consensus) // If we don't finish in the timeout (too much time passed checking for consensus)
TimeoutOr::Timeout | TimeoutOr::Timeout => {
log_stor!(debug "SetValue Fanout Timeout");
// Return the best answer we've got
let ctx = context.lock();
Ok(ctx.value.clone())
}
// If we finished with consensus (enough nodes returning the same value) // If we finished with consensus (enough nodes returning the same value)
TimeoutOr::Value(Ok(Some(()))) | TimeoutOr::Value(Ok(Some(()))) => {
log_stor!(debug "SetValue Fanout Consensus");
// Return the best answer we've got
let ctx = context.lock();
Ok(ctx.value.clone())
}
// If we finished without consensus (ran out of nodes before getting consensus) // If we finished without consensus (ran out of nodes before getting consensus)
TimeoutOr::Value(Ok(None)) => { TimeoutOr::Value(Ok(None)) => {
// Return the best answer we've got // Return the best answer we've got
let ctx = context.lock(); let ctx = context.lock();
log_stor!(debug "SetValue Fanout No Consensus: {}", ctx.value_count);
Ok(ctx.value.clone()) Ok(ctx.value.clone())
} }
// Failed // Failed
TimeoutOr::Value(Err(e)) => { TimeoutOr::Value(Err(e)) => {
// If we finished with an error, return that // If we finished with an error, return that
log_stor!(debug "SetValue Fanout Error: {}", e);
Err(e.into()) Err(e.into())
} }
} }
@ -167,7 +176,13 @@ impl StorageManager {
/// Handle a recieved 'Set Value' query /// Handle a recieved 'Set Value' query
/// Returns a None if the value passed in was set /// Returns a None if the value passed in was set
/// Returns a Some(current value) if the value was older and the current value was kept /// Returns a Some(current value) if the value was older and the current value was kept
pub async fn inbound_set_value(&self, key: TypedKey, subkey: ValueSubkey, value: SignedValueData, descriptor: Option<SignedValueDescriptor>) -> VeilidAPIResult<NetworkResult<Option<SignedValueData>>> { pub async fn inbound_set_value(
&self,
key: TypedKey,
subkey: ValueSubkey,
value: SignedValueData,
descriptor: Option<SignedValueDescriptor>,
) -> VeilidAPIResult<NetworkResult<Option<SignedValueData>>> {
let mut inner = self.lock().await?; let mut inner = self.lock().await?;
// See if this is a remote or local value // See if this is a remote or local value
@ -198,19 +213,23 @@ impl StorageManager {
if let Some(descriptor) = descriptor { if let Some(descriptor) = descriptor {
// Descriptor must match last one if it is provided // Descriptor must match last one if it is provided
if descriptor.cmp_no_sig(&last_descriptor) != cmp::Ordering::Equal { if descriptor.cmp_no_sig(&last_descriptor) != cmp::Ordering::Equal {
return Ok(NetworkResult::invalid_message("setvalue descriptor does not match last descriptor")); return Ok(NetworkResult::invalid_message(
"setvalue descriptor does not match last descriptor",
));
} }
} else { } else {
// Descriptor was not provided always go with last descriptor // Descriptor was not provided always go with last descriptor
} }
last_descriptor last_descriptor
} }
None => { None => {
if let Some(descriptor) = descriptor { if let Some(descriptor) = descriptor {
descriptor descriptor
} else { } else {
// No descriptor // No descriptor
return Ok(NetworkResult::invalid_message("descriptor must be provided")); return Ok(NetworkResult::invalid_message(
"descriptor must be provided",
));
} }
} }
}; };
@ -228,16 +247,18 @@ impl StorageManager {
let res = if is_local { let res = if is_local {
inner.handle_set_local_value(key, subkey, value).await inner.handle_set_local_value(key, subkey, value).await
} else { } else {
inner.handle_set_remote_value(key, subkey, value, actual_descriptor).await inner
.handle_set_remote_value(key, subkey, value, actual_descriptor)
.await
}; };
match res { match res {
Ok(()) => {}, Ok(()) => {}
Err(VeilidAPIError::Internal { message }) => { Err(VeilidAPIError::Internal { message }) => {
apibail_internal!(message); apibail_internal!(message);
}, }
Err(e) => { Err(e) => {
return Ok(NetworkResult::invalid_message(e)); return Ok(NetworkResult::invalid_message(e));
}, }
} }
Ok(NetworkResult::value(None)) Ok(NetworkResult::value(None))
} }

View File

@ -3,6 +3,12 @@ use super::*;
const STORAGE_MANAGER_METADATA: &str = "storage_manager_metadata"; const STORAGE_MANAGER_METADATA: &str = "storage_manager_metadata";
const OFFLINE_SUBKEY_WRITES: &[u8] = b"offline_subkey_writes"; const OFFLINE_SUBKEY_WRITES: &[u8] = b"offline_subkey_writes";
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub(super) struct OfflineSubkeyWrite {
pub safety_selection: SafetySelection,
pub subkeys: ValueSubkeyRangeSet,
}
/// Locked structure for storage manager /// Locked structure for storage manager
pub(super) struct StorageManagerInner { pub(super) struct StorageManagerInner {
unlocked_inner: Arc<StorageManagerUnlockedInner>, unlocked_inner: Arc<StorageManagerUnlockedInner>,
@ -15,7 +21,7 @@ pub(super) struct StorageManagerInner {
/// Records that have been pushed to this node for distribution by other nodes, that we make an effort to republish /// Records that have been pushed to this node for distribution by other nodes, that we make an effort to republish
pub remote_record_store: Option<RecordStore<RemoteRecordDetail>>, pub remote_record_store: Option<RecordStore<RemoteRecordDetail>>,
/// Record subkeys that have not been pushed to the network because they were written to offline /// Record subkeys that have not been pushed to the network because they were written to offline
pub offline_subkey_writes: HashMap<TypedKey, ValueSubkeyRangeSet>, pub offline_subkey_writes: HashMap<TypedKey, OfflineSubkeyWrite>,
/// Storage manager metadata that is persistent, including copy of offline subkey writes /// Storage manager metadata that is persistent, including copy of offline subkey writes
pub metadata_db: Option<TableDB>, pub metadata_db: Option<TableDB>,
/// RPC processor if it is available /// RPC processor if it is available

View File

@ -1,10 +1,11 @@
pub mod flush_record_stores; pub mod flush_record_stores;
pub mod offline_subkey_writes;
use super::*; use super::*;
impl StorageManager { impl StorageManager {
pub(crate) fn setup_tasks(&self) { pub(crate) fn setup_tasks(&self) {
// Set rolling transfers tick task // Set flush records tick task
debug!("starting flush record stores task"); debug!("starting flush record stores task");
{ {
let this = self.clone(); let this = self.clone();
@ -25,12 +26,40 @@ impl StorageManager {
) )
}); });
} }
// Set offline subkey writes tick task
debug!("starting offline subkey writes task");
{
let this = self.clone();
self.unlocked_inner
.offline_subkey_writes_task
.set_routine(move |s, l, t| {
Box::pin(
this.clone()
.offline_subkey_writes_task_routine(
s,
Timestamp::new(l),
Timestamp::new(t),
)
.instrument(trace_span!(
parent: None,
"StorageManager offline subkey writes task routine"
)),
)
});
}
} }
pub async fn tick(&self) -> EyreResult<()> { pub async fn tick(&self) -> EyreResult<()> {
// Run the rolling transfers task // Run the rolling transfers task
self.unlocked_inner.flush_record_stores_task.tick().await?; self.unlocked_inner.flush_record_stores_task.tick().await?;
// Run offline subkey writes task if there's work to be done
if self.online_writes_ready().await?.is_some() && self.has_offline_subkey_writes().await? {
self.unlocked_inner
.offline_subkey_writes_task
.tick()
.await?;
}
Ok(()) Ok(())
} }
@ -39,5 +68,9 @@ impl StorageManager {
if let Err(e) = self.unlocked_inner.flush_record_stores_task.stop().await { if let Err(e) = self.unlocked_inner.flush_record_stores_task.stop().await {
warn!("flush_record_stores_task not stopped: {}", e); warn!("flush_record_stores_task not stopped: {}", e);
} }
debug!("stopping offline subkey writes task");
if let Err(e) = self.unlocked_inner.offline_subkey_writes_task.stop().await {
warn!("offline_subkey_writes_task not stopped: {}", e);
}
} }
} }

View File

@ -0,0 +1,66 @@
use super::*;
use futures_util::*;
impl StorageManager {
// Best-effort write subkeys to the network that were written offline
#[instrument(level = "trace", skip(self), err)]
pub(crate) async fn offline_subkey_writes_task_routine(
self,
stop_token: StopToken,
_last_ts: Timestamp,
_cur_ts: Timestamp,
) -> EyreResult<()> {
let offline_subkey_writes = {
let inner = self.lock().await?;
inner.offline_subkey_writes.clone()
};
// make a safety selection that is conservative
for (key, osw) in offline_subkey_writes {
if poll!(stop_token.clone()).is_ready() {
log_stor!(debug "Offline subkey writes cancelled.");
break;
}
let Some(rpc_processor) = self.online_writes_ready().await? else {
log_stor!(debug "Offline subkey writes stopped for network.");
break;
};
for subkey in osw.subkeys.iter() {
let subkey_result = {
let mut inner = self.lock().await?;
inner.handle_get_local_value(key, subkey, true).await
};
let Ok(subkey_result) = subkey_result else {
log_stor!(debug "Offline subkey write had no subkey result: {}:{}", key, subkey);
continue;
};
let Some(value) = subkey_result.value else {
log_stor!(debug "Offline subkey write had no subkey value: {}:{}", key, subkey);
continue;
};
let Some(descriptor) = subkey_result.descriptor else {
log_stor!(debug "Offline subkey write had no descriptor: {}:{}", key, subkey);
continue;
};
log_stor!(debug "Offline subkey write: {}:{} len={}", key, subkey, value.value_data().data().len());
if let Err(e) = self
.outbound_set_value(
rpc_processor.clone(),
key,
subkey,
osw.safety_selection,
value,
descriptor,
)
.await
{
log_stor!(debug "failed to write offline subkey: {}", e);
}
}
let mut inner = self.lock().await?;
inner.offline_subkey_writes.remove(&key);
}
Ok(())
}
}

View File

@ -188,6 +188,10 @@ impl VeilidAPI {
stability: Stability, stability: Stability,
sequencing: Sequencing, sequencing: Sequencing,
) -> VeilidAPIResult<(RouteId, Vec<u8>)> { ) -> VeilidAPIResult<(RouteId, Vec<u8>)> {
for kind in crypto_kinds {
Crypto::validate_crypto_kind(*kind)?;
}
let default_route_hop_count: usize = { let default_route_hop_count: usize = {
let config = self.config()?; let config = self.config()?;
let c = config.get(); let c = config.get();

View File

@ -1341,6 +1341,28 @@ impl VeilidAPI {
} }
} }
async fn debug_punish_list(&self, _args: Vec<String>) -> VeilidAPIResult<String> {
//
let network_manager = self.network_manager()?;
let address_filter = network_manager.address_filter();
let out = format!("Address Filter Punishments:\n{:#?}", address_filter);
return Ok(out);
}
async fn debug_punish(&self, args: String) -> VeilidAPIResult<String> {
let args: Vec<String> =
shell_words::split(&args).map_err(|e| VeilidAPIError::parse_error(e, args))?;
let command = get_debug_argument_at(&args, 0, "debug_punish", "command", get_string)?;
if command == "list" {
self.debug_punish_list(args).await
} else {
Ok(">>> Unknown command\n".to_owned())
}
}
pub async fn debug_help(&self, _args: String) -> VeilidAPIResult<String> { pub async fn debug_help(&self, _args: String) -> VeilidAPIResult<String> {
Ok(r#"buckets [dead|reliable] Ok(r#"buckets [dead|reliable]
dialinfo dialinfo
@ -1358,6 +1380,7 @@ restart network
contact <node>[<modifiers>] contact <node>[<modifiers>]
ping <destination> ping <destination>
relay <relay> [public|local] relay <relay> [public|local]
punish list
route allocate [ord|*ord] [rel] [<count>] [in|out] route allocate [ord|*ord] [rel] [<count>] [in|out]
release <route> release <route>
publish <route> [full] publish <route> [full]
@ -1450,6 +1473,8 @@ record list <local|remote>
self.debug_route(rest).await self.debug_route(rest).await
} else if arg == "record" { } else if arg == "record" {
self.debug_record(rest).await self.debug_record(rest).await
} else if arg == "punish" {
self.debug_punish(rest).await
} else { } else {
Err(VeilidAPIError::generic("Unknown server debug command")) Err(VeilidAPIError::generic("Unknown server debug command"))
} }

View File

@ -199,6 +199,7 @@ impl RoutingContext {
kind: Option<CryptoKind>, kind: Option<CryptoKind>,
) -> VeilidAPIResult<DHTRecordDescriptor> { ) -> VeilidAPIResult<DHTRecordDescriptor> {
let kind = kind.unwrap_or(best_crypto_kind()); let kind = kind.unwrap_or(best_crypto_kind());
Crypto::validate_crypto_kind(kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager storage_manager
.create_record(kind, schema, self.unlocked_inner.safety_selection) .create_record(kind, schema, self.unlocked_inner.safety_selection)
@ -213,6 +214,7 @@ impl RoutingContext {
key: TypedKey, key: TypedKey,
writer: Option<KeyPair>, writer: Option<KeyPair>,
) -> VeilidAPIResult<DHTRecordDescriptor> { ) -> VeilidAPIResult<DHTRecordDescriptor> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager storage_manager
.open_record(key, writer, self.unlocked_inner.safety_selection) .open_record(key, writer, self.unlocked_inner.safety_selection)
@ -222,6 +224,7 @@ impl RoutingContext {
/// Closes a DHT record at a specific key that was opened with create_dht_record or open_dht_record. /// Closes a DHT record at a specific key that was opened with create_dht_record or open_dht_record.
/// Closing a record allows you to re-open it with a different routing context /// Closing a record allows you to re-open it with a different routing context
pub async fn close_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> { pub async fn close_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager.close_record(key).await storage_manager.close_record(key).await
} }
@ -230,6 +233,7 @@ impl RoutingContext {
/// Deleting a record does not delete it from the network, but will remove the storage of the record /// Deleting a record does not delete it from the network, but will remove the storage of the record
/// locally, and will prevent its value from being refreshed on the network by this node. /// locally, and will prevent its value from being refreshed on the network by this node.
pub async fn delete_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> { pub async fn delete_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager.delete_record(key).await storage_manager.delete_record(key).await
} }
@ -244,6 +248,7 @@ impl RoutingContext {
subkey: ValueSubkey, subkey: ValueSubkey,
force_refresh: bool, force_refresh: bool,
) -> VeilidAPIResult<Option<ValueData>> { ) -> VeilidAPIResult<Option<ValueData>> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager.get_value(key, subkey, force_refresh).await storage_manager.get_value(key, subkey, force_refresh).await
} }
@ -257,6 +262,7 @@ impl RoutingContext {
subkey: ValueSubkey, subkey: ValueSubkey,
data: Vec<u8>, data: Vec<u8>,
) -> VeilidAPIResult<Option<ValueData>> { ) -> VeilidAPIResult<Option<ValueData>> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager.set_value(key, subkey, data).await storage_manager.set_value(key, subkey, data).await
} }
@ -273,6 +279,7 @@ impl RoutingContext {
expiration: Timestamp, expiration: Timestamp,
count: u32, count: u32,
) -> VeilidAPIResult<Timestamp> { ) -> VeilidAPIResult<Timestamp> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager storage_manager
.watch_values(key, subkeys, expiration, count) .watch_values(key, subkeys, expiration, count)
@ -286,6 +293,7 @@ impl RoutingContext {
key: TypedKey, key: TypedKey,
subkeys: ValueSubkeyRangeSet, subkeys: ValueSubkeyRangeSet,
) -> VeilidAPIResult<bool> { ) -> VeilidAPIResult<bool> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?; let storage_manager = self.api.storage_manager()?;
storage_manager.cancel_watch_values(key, subkeys).await storage_manager.cancel_watch_values(key, subkeys).await
} }

View File

@ -113,6 +113,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -403,7 +411,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "0.1.6" version: "0.1.7"
win32: win32:
dependency: transitive dependency: transitive
description: description:
@ -430,4 +438,4 @@ packages:
version: "3.5.0" version: "3.5.0"
sdks: sdks:
dart: ">=3.0.0 <4.0.0" dart: ">=3.0.0 <4.0.0"
flutter: ">=3.7.0" flutter: ">=3.10.6"

View File

@ -117,15 +117,15 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async =>
), ),
dht: VeilidConfigDHT( dht: VeilidConfigDHT(
resolveNodeTimeoutMs: 10000, resolveNodeTimeoutMs: 10000,
resolveNodeCount: 20, resolveNodeCount: 1,
resolveNodeFanout: 3, resolveNodeFanout: 4,
maxFindNodeCount: 20, maxFindNodeCount: 20,
getValueTimeoutMs: 10000, getValueTimeoutMs: 10000,
getValueCount: 20, getValueCount: 3,
getValueFanout: 3, getValueFanout: 4,
setValueTimeoutMs: 10000, setValueTimeoutMs: 10000,
setValueCount: 20, setValueCount: 4,
setValueFanout: 5, setValueFanout: 6,
minPeerCount: 20, minPeerCount: 20,
minPeerRefreshTimeMs: 60000, minPeerRefreshTimeMs: 60000,
validateDialInfoReceiptTimeMs: 2000, validateDialInfoReceiptTimeMs: 2000,

View File

@ -600,8 +600,8 @@ DHTRecordDescriptor _$DHTRecordDescriptorFromJson(Map<String, dynamic> json) {
mixin _$DHTRecordDescriptor { mixin _$DHTRecordDescriptor {
Typed<FixedEncodedString43> get key => throw _privateConstructorUsedError; Typed<FixedEncodedString43> get key => throw _privateConstructorUsedError;
FixedEncodedString43 get owner => throw _privateConstructorUsedError; FixedEncodedString43 get owner => throw _privateConstructorUsedError;
FixedEncodedString43? get ownerSecret => throw _privateConstructorUsedError;
DHTSchema get schema => throw _privateConstructorUsedError; DHTSchema get schema => throw _privateConstructorUsedError;
FixedEncodedString43? get ownerSecret => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -618,8 +618,8 @@ abstract class $DHTRecordDescriptorCopyWith<$Res> {
$Res call( $Res call(
{Typed<FixedEncodedString43> key, {Typed<FixedEncodedString43> key,
FixedEncodedString43 owner, FixedEncodedString43 owner,
FixedEncodedString43? ownerSecret, DHTSchema schema,
DHTSchema schema}); FixedEncodedString43? ownerSecret});
$DHTSchemaCopyWith<$Res> get schema; $DHTSchemaCopyWith<$Res> get schema;
} }
@ -639,8 +639,8 @@ class _$DHTRecordDescriptorCopyWithImpl<$Res, $Val extends DHTRecordDescriptor>
$Res call({ $Res call({
Object? key = null, Object? key = null,
Object? owner = null, Object? owner = null,
Object? ownerSecret = freezed,
Object? schema = null, Object? schema = null,
Object? ownerSecret = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
key: null == key key: null == key
@ -651,14 +651,14 @@ class _$DHTRecordDescriptorCopyWithImpl<$Res, $Val extends DHTRecordDescriptor>
? _value.owner ? _value.owner
: owner // ignore: cast_nullable_to_non_nullable : owner // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43, as FixedEncodedString43,
ownerSecret: freezed == ownerSecret
? _value.ownerSecret
: ownerSecret // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43?,
schema: null == schema schema: null == schema
? _value.schema ? _value.schema
: schema // ignore: cast_nullable_to_non_nullable : schema // ignore: cast_nullable_to_non_nullable
as DHTSchema, as DHTSchema,
ownerSecret: freezed == ownerSecret
? _value.ownerSecret
: ownerSecret // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43?,
) as $Val); ) as $Val);
} }
@ -682,8 +682,8 @@ abstract class _$$_DHTRecordDescriptorCopyWith<$Res>
$Res call( $Res call(
{Typed<FixedEncodedString43> key, {Typed<FixedEncodedString43> key,
FixedEncodedString43 owner, FixedEncodedString43 owner,
FixedEncodedString43? ownerSecret, DHTSchema schema,
DHTSchema schema}); FixedEncodedString43? ownerSecret});
@override @override
$DHTSchemaCopyWith<$Res> get schema; $DHTSchemaCopyWith<$Res> get schema;
@ -702,8 +702,8 @@ class __$$_DHTRecordDescriptorCopyWithImpl<$Res>
$Res call({ $Res call({
Object? key = null, Object? key = null,
Object? owner = null, Object? owner = null,
Object? ownerSecret = freezed,
Object? schema = null, Object? schema = null,
Object? ownerSecret = freezed,
}) { }) {
return _then(_$_DHTRecordDescriptor( return _then(_$_DHTRecordDescriptor(
key: null == key key: null == key
@ -714,14 +714,14 @@ class __$$_DHTRecordDescriptorCopyWithImpl<$Res>
? _value.owner ? _value.owner
: owner // ignore: cast_nullable_to_non_nullable : owner // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43, as FixedEncodedString43,
ownerSecret: freezed == ownerSecret
? _value.ownerSecret
: ownerSecret // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43?,
schema: null == schema schema: null == schema
? _value.schema ? _value.schema
: schema // ignore: cast_nullable_to_non_nullable : schema // ignore: cast_nullable_to_non_nullable
as DHTSchema, as DHTSchema,
ownerSecret: freezed == ownerSecret
? _value.ownerSecret
: ownerSecret // ignore: cast_nullable_to_non_nullable
as FixedEncodedString43?,
)); ));
} }
} }
@ -732,8 +732,8 @@ class _$_DHTRecordDescriptor implements _DHTRecordDescriptor {
const _$_DHTRecordDescriptor( const _$_DHTRecordDescriptor(
{required this.key, {required this.key,
required this.owner, required this.owner,
this.ownerSecret, required this.schema,
required this.schema}); this.ownerSecret});
factory _$_DHTRecordDescriptor.fromJson(Map<String, dynamic> json) => factory _$_DHTRecordDescriptor.fromJson(Map<String, dynamic> json) =>
_$$_DHTRecordDescriptorFromJson(json); _$$_DHTRecordDescriptorFromJson(json);
@ -743,13 +743,13 @@ class _$_DHTRecordDescriptor implements _DHTRecordDescriptor {
@override @override
final FixedEncodedString43 owner; final FixedEncodedString43 owner;
@override @override
final FixedEncodedString43? ownerSecret;
@override
final DHTSchema schema; final DHTSchema schema;
@override
final FixedEncodedString43? ownerSecret;
@override @override
String toString() { String toString() {
return 'DHTRecordDescriptor(key: $key, owner: $owner, ownerSecret: $ownerSecret, schema: $schema)'; return 'DHTRecordDescriptor(key: $key, owner: $owner, schema: $schema, ownerSecret: $ownerSecret)';
} }
@override @override
@ -759,14 +759,14 @@ class _$_DHTRecordDescriptor implements _DHTRecordDescriptor {
other is _$_DHTRecordDescriptor && other is _$_DHTRecordDescriptor &&
(identical(other.key, key) || other.key == key) && (identical(other.key, key) || other.key == key) &&
(identical(other.owner, owner) || other.owner == owner) && (identical(other.owner, owner) || other.owner == owner) &&
(identical(other.schema, schema) || other.schema == schema) &&
(identical(other.ownerSecret, ownerSecret) || (identical(other.ownerSecret, ownerSecret) ||
other.ownerSecret == ownerSecret) && other.ownerSecret == ownerSecret));
(identical(other.schema, schema) || other.schema == schema));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash(runtimeType, key, owner, ownerSecret, schema); int get hashCode => Object.hash(runtimeType, key, owner, schema, ownerSecret);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -787,8 +787,8 @@ abstract class _DHTRecordDescriptor implements DHTRecordDescriptor {
const factory _DHTRecordDescriptor( const factory _DHTRecordDescriptor(
{required final Typed<FixedEncodedString43> key, {required final Typed<FixedEncodedString43> key,
required final FixedEncodedString43 owner, required final FixedEncodedString43 owner,
final FixedEncodedString43? ownerSecret, required final DHTSchema schema,
required final DHTSchema schema}) = _$_DHTRecordDescriptor; final FixedEncodedString43? ownerSecret}) = _$_DHTRecordDescriptor;
factory _DHTRecordDescriptor.fromJson(Map<String, dynamic> json) = factory _DHTRecordDescriptor.fromJson(Map<String, dynamic> json) =
_$_DHTRecordDescriptor.fromJson; _$_DHTRecordDescriptor.fromJson;
@ -798,10 +798,10 @@ abstract class _DHTRecordDescriptor implements DHTRecordDescriptor {
@override @override
FixedEncodedString43 get owner; FixedEncodedString43 get owner;
@override @override
FixedEncodedString43? get ownerSecret;
@override
DHTSchema get schema; DHTSchema get schema;
@override @override
FixedEncodedString43? get ownerSecret;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$_DHTRecordDescriptorCopyWith<_$_DHTRecordDescriptor> get copyWith => _$$_DHTRecordDescriptorCopyWith<_$_DHTRecordDescriptor> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -1151,10 +1151,10 @@ SafetySpec _$SafetySpecFromJson(Map<String, dynamic> json) {
/// @nodoc /// @nodoc
mixin _$SafetySpec { mixin _$SafetySpec {
String? get preferredRoute => throw _privateConstructorUsedError;
int get hopCount => throw _privateConstructorUsedError; int get hopCount => throw _privateConstructorUsedError;
Stability get stability => throw _privateConstructorUsedError; Stability get stability => throw _privateConstructorUsedError;
Sequencing get sequencing => throw _privateConstructorUsedError; Sequencing get sequencing => throw _privateConstructorUsedError;
String? get preferredRoute => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -1169,10 +1169,10 @@ abstract class $SafetySpecCopyWith<$Res> {
_$SafetySpecCopyWithImpl<$Res, SafetySpec>; _$SafetySpecCopyWithImpl<$Res, SafetySpec>;
@useResult @useResult
$Res call( $Res call(
{String? preferredRoute, {int hopCount,
int hopCount,
Stability stability, Stability stability,
Sequencing sequencing}); Sequencing sequencing,
String? preferredRoute});
} }
/// @nodoc /// @nodoc
@ -1188,16 +1188,12 @@ class _$SafetySpecCopyWithImpl<$Res, $Val extends SafetySpec>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? preferredRoute = freezed,
Object? hopCount = null, Object? hopCount = null,
Object? stability = null, Object? stability = null,
Object? sequencing = null, Object? sequencing = null,
Object? preferredRoute = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
preferredRoute: freezed == preferredRoute
? _value.preferredRoute
: preferredRoute // ignore: cast_nullable_to_non_nullable
as String?,
hopCount: null == hopCount hopCount: null == hopCount
? _value.hopCount ? _value.hopCount
: hopCount // ignore: cast_nullable_to_non_nullable : hopCount // ignore: cast_nullable_to_non_nullable
@ -1210,6 +1206,10 @@ class _$SafetySpecCopyWithImpl<$Res, $Val extends SafetySpec>
? _value.sequencing ? _value.sequencing
: sequencing // ignore: cast_nullable_to_non_nullable : sequencing // ignore: cast_nullable_to_non_nullable
as Sequencing, as Sequencing,
preferredRoute: freezed == preferredRoute
? _value.preferredRoute
: preferredRoute // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val); ) as $Val);
} }
} }
@ -1223,10 +1223,10 @@ abstract class _$$_SafetySpecCopyWith<$Res>
@override @override
@useResult @useResult
$Res call( $Res call(
{String? preferredRoute, {int hopCount,
int hopCount,
Stability stability, Stability stability,
Sequencing sequencing}); Sequencing sequencing,
String? preferredRoute});
} }
/// @nodoc /// @nodoc
@ -1240,16 +1240,12 @@ class __$$_SafetySpecCopyWithImpl<$Res>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? preferredRoute = freezed,
Object? hopCount = null, Object? hopCount = null,
Object? stability = null, Object? stability = null,
Object? sequencing = null, Object? sequencing = null,
Object? preferredRoute = freezed,
}) { }) {
return _then(_$_SafetySpec( return _then(_$_SafetySpec(
preferredRoute: freezed == preferredRoute
? _value.preferredRoute
: preferredRoute // ignore: cast_nullable_to_non_nullable
as String?,
hopCount: null == hopCount hopCount: null == hopCount
? _value.hopCount ? _value.hopCount
: hopCount // ignore: cast_nullable_to_non_nullable : hopCount // ignore: cast_nullable_to_non_nullable
@ -1262,6 +1258,10 @@ class __$$_SafetySpecCopyWithImpl<$Res>
? _value.sequencing ? _value.sequencing
: sequencing // ignore: cast_nullable_to_non_nullable : sequencing // ignore: cast_nullable_to_non_nullable
as Sequencing, as Sequencing,
preferredRoute: freezed == preferredRoute
? _value.preferredRoute
: preferredRoute // ignore: cast_nullable_to_non_nullable
as String?,
)); ));
} }
} }
@ -1270,26 +1270,26 @@ class __$$_SafetySpecCopyWithImpl<$Res>
@JsonSerializable() @JsonSerializable()
class _$_SafetySpec implements _SafetySpec { class _$_SafetySpec implements _SafetySpec {
const _$_SafetySpec( const _$_SafetySpec(
{this.preferredRoute, {required this.hopCount,
required this.hopCount,
required this.stability, required this.stability,
required this.sequencing}); required this.sequencing,
this.preferredRoute});
factory _$_SafetySpec.fromJson(Map<String, dynamic> json) => factory _$_SafetySpec.fromJson(Map<String, dynamic> json) =>
_$$_SafetySpecFromJson(json); _$$_SafetySpecFromJson(json);
@override
final String? preferredRoute;
@override @override
final int hopCount; final int hopCount;
@override @override
final Stability stability; final Stability stability;
@override @override
final Sequencing sequencing; final Sequencing sequencing;
@override
final String? preferredRoute;
@override @override
String toString() { String toString() {
return 'SafetySpec(preferredRoute: $preferredRoute, hopCount: $hopCount, stability: $stability, sequencing: $sequencing)'; return 'SafetySpec(hopCount: $hopCount, stability: $stability, sequencing: $sequencing, preferredRoute: $preferredRoute)';
} }
@override @override
@ -1297,20 +1297,20 @@ class _$_SafetySpec implements _SafetySpec {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$_SafetySpec && other is _$_SafetySpec &&
(identical(other.preferredRoute, preferredRoute) ||
other.preferredRoute == preferredRoute) &&
(identical(other.hopCount, hopCount) || (identical(other.hopCount, hopCount) ||
other.hopCount == hopCount) && other.hopCount == hopCount) &&
(identical(other.stability, stability) || (identical(other.stability, stability) ||
other.stability == stability) && other.stability == stability) &&
(identical(other.sequencing, sequencing) || (identical(other.sequencing, sequencing) ||
other.sequencing == sequencing)); other.sequencing == sequencing) &&
(identical(other.preferredRoute, preferredRoute) ||
other.preferredRoute == preferredRoute));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => int get hashCode =>
Object.hash(runtimeType, preferredRoute, hopCount, stability, sequencing); Object.hash(runtimeType, hopCount, stability, sequencing, preferredRoute);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -1328,16 +1328,14 @@ class _$_SafetySpec implements _SafetySpec {
abstract class _SafetySpec implements SafetySpec { abstract class _SafetySpec implements SafetySpec {
const factory _SafetySpec( const factory _SafetySpec(
{final String? preferredRoute, {required final int hopCount,
required final int hopCount,
required final Stability stability, required final Stability stability,
required final Sequencing sequencing}) = _$_SafetySpec; required final Sequencing sequencing,
final String? preferredRoute}) = _$_SafetySpec;
factory _SafetySpec.fromJson(Map<String, dynamic> json) = factory _SafetySpec.fromJson(Map<String, dynamic> json) =
_$_SafetySpec.fromJson; _$_SafetySpec.fromJson;
@override
String? get preferredRoute;
@override @override
int get hopCount; int get hopCount;
@override @override
@ -1345,6 +1343,8 @@ abstract class _SafetySpec implements SafetySpec {
@override @override
Sequencing get sequencing; Sequencing get sequencing;
@override @override
String? get preferredRoute;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$_SafetySpecCopyWith<_$_SafetySpec> get copyWith => _$$_SafetySpecCopyWith<_$_SafetySpec> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;

View File

@ -22,7 +22,7 @@ _$DHTSchemaSMPL _$$DHTSchemaSMPLFromJson(Map<String, dynamic> json) =>
_$DHTSchemaSMPL( _$DHTSchemaSMPL(
oCnt: json['o_cnt'] as int, oCnt: json['o_cnt'] as int,
members: (json['members'] as List<dynamic>) members: (json['members'] as List<dynamic>)
.map((e) => DHTSchemaMember.fromJson(e as Map<String, dynamic>)) .map(DHTSchemaMember.fromJson)
.toList(), .toList(),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -51,10 +51,10 @@ _$_DHTRecordDescriptor _$$_DHTRecordDescriptorFromJson(
_$_DHTRecordDescriptor( _$_DHTRecordDescriptor(
key: Typed<FixedEncodedString43>.fromJson(json['key']), key: Typed<FixedEncodedString43>.fromJson(json['key']),
owner: FixedEncodedString43.fromJson(json['owner']), owner: FixedEncodedString43.fromJson(json['owner']),
schema: DHTSchema.fromJson(json['schema']),
ownerSecret: json['owner_secret'] == null ownerSecret: json['owner_secret'] == null
? null ? null
: FixedEncodedString43.fromJson(json['owner_secret']), : FixedEncodedString43.fromJson(json['owner_secret']),
schema: DHTSchema.fromJson(json['schema'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_DHTRecordDescriptorToJson( Map<String, dynamic> _$$_DHTRecordDescriptorToJson(
@ -62,8 +62,8 @@ Map<String, dynamic> _$$_DHTRecordDescriptorToJson(
<String, dynamic>{ <String, dynamic>{
'key': instance.key.toJson(), 'key': instance.key.toJson(),
'owner': instance.owner.toJson(), 'owner': instance.owner.toJson(),
'owner_secret': instance.ownerSecret?.toJson(),
'schema': instance.schema.toJson(), 'schema': instance.schema.toJson(),
'owner_secret': instance.ownerSecret?.toJson(),
}; };
_$_ValueSubkeyRange _$$_ValueSubkeyRangeFromJson(Map<String, dynamic> json) => _$_ValueSubkeyRange _$$_ValueSubkeyRangeFromJson(Map<String, dynamic> json) =>
@ -93,18 +93,18 @@ Map<String, dynamic> _$$_ValueDataToJson(_$_ValueData instance) =>
_$_SafetySpec _$$_SafetySpecFromJson(Map<String, dynamic> json) => _$_SafetySpec _$$_SafetySpecFromJson(Map<String, dynamic> json) =>
_$_SafetySpec( _$_SafetySpec(
preferredRoute: json['preferred_route'] as String?,
hopCount: json['hop_count'] as int, hopCount: json['hop_count'] as int,
stability: Stability.fromJson(json['stability'] as String), stability: Stability.fromJson(json['stability']),
sequencing: Sequencing.fromJson(json['sequencing'] as String), sequencing: Sequencing.fromJson(json['sequencing']),
preferredRoute: json['preferred_route'] as String?,
); );
Map<String, dynamic> _$$_SafetySpecToJson(_$_SafetySpec instance) => Map<String, dynamic> _$$_SafetySpecToJson(_$_SafetySpec instance) =>
<String, dynamic>{ <String, dynamic>{
'preferred_route': instance.preferredRoute,
'hop_count': instance.hopCount, 'hop_count': instance.hopCount,
'stability': instance.stability.toJson(), 'stability': instance.stability.toJson(),
'sequencing': instance.sequencing.toJson(), 'sequencing': instance.sequencing.toJson(),
'preferred_route': instance.preferredRoute,
}; };
_$_RouteBlob _$$_RouteBlobFromJson(Map<String, dynamic> json) => _$_RouteBlob( _$_RouteBlob _$$_RouteBlobFromJson(Map<String, dynamic> json) => _$_RouteBlob(

View File

@ -3,6 +3,7 @@ import 'dart:typed_data';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:fixnum/fixnum.dart';
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@ -59,8 +60,11 @@ class VeilidVersion extends Equatable {
////////////////////////////////////// //////////////////////////////////////
/// Timestamp /// Timestamp
@immutable @immutable
class Timestamp extends Equatable { class Timestamp extends Equatable implements Comparable<Timestamp> {
const Timestamp({required this.value}); const Timestamp({required this.value});
factory Timestamp.fromInt64(Int64 i64) => Timestamp(
value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) |
BigInt.from(i64.toUnsigned(32).toInt()));
factory Timestamp.fromString(String s) => Timestamp(value: BigInt.parse(s)); factory Timestamp.fromString(String s) => Timestamp(value: BigInt.parse(s));
factory Timestamp.fromJson(dynamic json) => factory Timestamp.fromJson(dynamic json) =>
Timestamp.fromString(json as String); Timestamp.fromString(json as String);
@ -69,9 +73,13 @@ class Timestamp extends Equatable {
List<Object> get props => [value]; List<Object> get props => [value];
@override @override
String toString() => value.toString(); int compareTo(Timestamp other) => value.compareTo(other.value);
@override
String toString() => value.toString();
String toJson() => toString(); String toJson() => toString();
Int64 toInt64() => Int64.fromInts(
(value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt());
TimestampDuration diff(Timestamp other) => TimestampDuration diff(Timestamp other) =>
TimestampDuration(value: value - other.value); TimestampDuration(value: value - other.value);
@ -81,8 +89,12 @@ class Timestamp extends Equatable {
} }
@immutable @immutable
class TimestampDuration extends Equatable { class TimestampDuration extends Equatable
implements Comparable<TimestampDuration> {
const TimestampDuration({required this.value}); const TimestampDuration({required this.value});
factory TimestampDuration.fromInt64(Int64 i64) => TimestampDuration(
value: (BigInt.from((i64 >> 32).toUnsigned(32).toInt()) << 32) |
BigInt.from(i64.toUnsigned(32).toInt()));
factory TimestampDuration.fromString(String s) => factory TimestampDuration.fromString(String s) =>
TimestampDuration(value: BigInt.parse(s)); TimestampDuration(value: BigInt.parse(s));
factory TimestampDuration.fromJson(dynamic json) => factory TimestampDuration.fromJson(dynamic json) =>
@ -92,9 +104,13 @@ class TimestampDuration extends Equatable {
List<Object> get props => [value]; List<Object> get props => [value];
@override @override
String toString() => value.toString(); int compareTo(TimestampDuration other) => value.compareTo(other.value);
@override
String toString() => value.toString();
String toJson() => toString(); String toJson() => toString();
Int64 toInt64() => Int64.fromInts(
(value >> 32).toUnsigned(32).toInt(), value.toUnsigned(32).toInt());
int toMillis() => (value ~/ BigInt.from(1000)).toInt(); int toMillis() => (value ~/ BigInt.from(1000)).toInt();
BigInt toMicros() => value; BigInt toMicros() => value;

View File

@ -4377,11 +4377,11 @@ VeilidConfigRPC _$VeilidConfigRPCFromJson(Map<String, dynamic> json) {
mixin _$VeilidConfigRPC { mixin _$VeilidConfigRPC {
int get concurrency => throw _privateConstructorUsedError; int get concurrency => throw _privateConstructorUsedError;
int get queueSize => throw _privateConstructorUsedError; int get queueSize => throw _privateConstructorUsedError;
int? get maxTimestampBehindMs => throw _privateConstructorUsedError;
int? get maxTimestampAheadMs => throw _privateConstructorUsedError;
int get timeoutMs => throw _privateConstructorUsedError; int get timeoutMs => throw _privateConstructorUsedError;
int get maxRouteHopCount => throw _privateConstructorUsedError; int get maxRouteHopCount => throw _privateConstructorUsedError;
int get defaultRouteHopCount => throw _privateConstructorUsedError; int get defaultRouteHopCount => throw _privateConstructorUsedError;
int? get maxTimestampBehindMs => throw _privateConstructorUsedError;
int? get maxTimestampAheadMs => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -4398,11 +4398,11 @@ abstract class $VeilidConfigRPCCopyWith<$Res> {
$Res call( $Res call(
{int concurrency, {int concurrency,
int queueSize, int queueSize,
int? maxTimestampBehindMs,
int? maxTimestampAheadMs,
int timeoutMs, int timeoutMs,
int maxRouteHopCount, int maxRouteHopCount,
int defaultRouteHopCount}); int defaultRouteHopCount,
int? maxTimestampBehindMs,
int? maxTimestampAheadMs});
} }
/// @nodoc /// @nodoc
@ -4420,11 +4420,11 @@ class _$VeilidConfigRPCCopyWithImpl<$Res, $Val extends VeilidConfigRPC>
$Res call({ $Res call({
Object? concurrency = null, Object? concurrency = null,
Object? queueSize = null, Object? queueSize = null,
Object? maxTimestampBehindMs = freezed,
Object? maxTimestampAheadMs = freezed,
Object? timeoutMs = null, Object? timeoutMs = null,
Object? maxRouteHopCount = null, Object? maxRouteHopCount = null,
Object? defaultRouteHopCount = null, Object? defaultRouteHopCount = null,
Object? maxTimestampBehindMs = freezed,
Object? maxTimestampAheadMs = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
concurrency: null == concurrency concurrency: null == concurrency
@ -4435,14 +4435,6 @@ class _$VeilidConfigRPCCopyWithImpl<$Res, $Val extends VeilidConfigRPC>
? _value.queueSize ? _value.queueSize
: queueSize // ignore: cast_nullable_to_non_nullable : queueSize // ignore: cast_nullable_to_non_nullable
as int, as int,
maxTimestampBehindMs: freezed == maxTimestampBehindMs
? _value.maxTimestampBehindMs
: maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable
as int?,
maxTimestampAheadMs: freezed == maxTimestampAheadMs
? _value.maxTimestampAheadMs
: maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable
as int?,
timeoutMs: null == timeoutMs timeoutMs: null == timeoutMs
? _value.timeoutMs ? _value.timeoutMs
: timeoutMs // ignore: cast_nullable_to_non_nullable : timeoutMs // ignore: cast_nullable_to_non_nullable
@ -4455,6 +4447,14 @@ class _$VeilidConfigRPCCopyWithImpl<$Res, $Val extends VeilidConfigRPC>
? _value.defaultRouteHopCount ? _value.defaultRouteHopCount
: defaultRouteHopCount // ignore: cast_nullable_to_non_nullable : defaultRouteHopCount // ignore: cast_nullable_to_non_nullable
as int, as int,
maxTimestampBehindMs: freezed == maxTimestampBehindMs
? _value.maxTimestampBehindMs
: maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable
as int?,
maxTimestampAheadMs: freezed == maxTimestampAheadMs
? _value.maxTimestampAheadMs
: maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val); ) as $Val);
} }
} }
@ -4470,11 +4470,11 @@ abstract class _$$_VeilidConfigRPCCopyWith<$Res>
$Res call( $Res call(
{int concurrency, {int concurrency,
int queueSize, int queueSize,
int? maxTimestampBehindMs,
int? maxTimestampAheadMs,
int timeoutMs, int timeoutMs,
int maxRouteHopCount, int maxRouteHopCount,
int defaultRouteHopCount}); int defaultRouteHopCount,
int? maxTimestampBehindMs,
int? maxTimestampAheadMs});
} }
/// @nodoc /// @nodoc
@ -4490,11 +4490,11 @@ class __$$_VeilidConfigRPCCopyWithImpl<$Res>
$Res call({ $Res call({
Object? concurrency = null, Object? concurrency = null,
Object? queueSize = null, Object? queueSize = null,
Object? maxTimestampBehindMs = freezed,
Object? maxTimestampAheadMs = freezed,
Object? timeoutMs = null, Object? timeoutMs = null,
Object? maxRouteHopCount = null, Object? maxRouteHopCount = null,
Object? defaultRouteHopCount = null, Object? defaultRouteHopCount = null,
Object? maxTimestampBehindMs = freezed,
Object? maxTimestampAheadMs = freezed,
}) { }) {
return _then(_$_VeilidConfigRPC( return _then(_$_VeilidConfigRPC(
concurrency: null == concurrency concurrency: null == concurrency
@ -4505,14 +4505,6 @@ class __$$_VeilidConfigRPCCopyWithImpl<$Res>
? _value.queueSize ? _value.queueSize
: queueSize // ignore: cast_nullable_to_non_nullable : queueSize // ignore: cast_nullable_to_non_nullable
as int, as int,
maxTimestampBehindMs: freezed == maxTimestampBehindMs
? _value.maxTimestampBehindMs
: maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable
as int?,
maxTimestampAheadMs: freezed == maxTimestampAheadMs
? _value.maxTimestampAheadMs
: maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable
as int?,
timeoutMs: null == timeoutMs timeoutMs: null == timeoutMs
? _value.timeoutMs ? _value.timeoutMs
: timeoutMs // ignore: cast_nullable_to_non_nullable : timeoutMs // ignore: cast_nullable_to_non_nullable
@ -4525,6 +4517,14 @@ class __$$_VeilidConfigRPCCopyWithImpl<$Res>
? _value.defaultRouteHopCount ? _value.defaultRouteHopCount
: defaultRouteHopCount // ignore: cast_nullable_to_non_nullable : defaultRouteHopCount // ignore: cast_nullable_to_non_nullable
as int, as int,
maxTimestampBehindMs: freezed == maxTimestampBehindMs
? _value.maxTimestampBehindMs
: maxTimestampBehindMs // ignore: cast_nullable_to_non_nullable
as int?,
maxTimestampAheadMs: freezed == maxTimestampAheadMs
? _value.maxTimestampAheadMs
: maxTimestampAheadMs // ignore: cast_nullable_to_non_nullable
as int?,
)); ));
} }
} }
@ -4537,11 +4537,11 @@ class _$_VeilidConfigRPC
const _$_VeilidConfigRPC( const _$_VeilidConfigRPC(
{required this.concurrency, {required this.concurrency,
required this.queueSize, required this.queueSize,
this.maxTimestampBehindMs,
this.maxTimestampAheadMs,
required this.timeoutMs, required this.timeoutMs,
required this.maxRouteHopCount, required this.maxRouteHopCount,
required this.defaultRouteHopCount}); required this.defaultRouteHopCount,
this.maxTimestampBehindMs,
this.maxTimestampAheadMs});
factory _$_VeilidConfigRPC.fromJson(Map<String, dynamic> json) => factory _$_VeilidConfigRPC.fromJson(Map<String, dynamic> json) =>
_$$_VeilidConfigRPCFromJson(json); _$$_VeilidConfigRPCFromJson(json);
@ -4551,19 +4551,19 @@ class _$_VeilidConfigRPC
@override @override
final int queueSize; final int queueSize;
@override @override
final int? maxTimestampBehindMs;
@override
final int? maxTimestampAheadMs;
@override
final int timeoutMs; final int timeoutMs;
@override @override
final int maxRouteHopCount; final int maxRouteHopCount;
@override @override
final int defaultRouteHopCount; final int defaultRouteHopCount;
@override
final int? maxTimestampBehindMs;
@override
final int? maxTimestampAheadMs;
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'VeilidConfigRPC(concurrency: $concurrency, queueSize: $queueSize, maxTimestampBehindMs: $maxTimestampBehindMs, maxTimestampAheadMs: $maxTimestampAheadMs, timeoutMs: $timeoutMs, maxRouteHopCount: $maxRouteHopCount, defaultRouteHopCount: $defaultRouteHopCount)'; return 'VeilidConfigRPC(concurrency: $concurrency, queueSize: $queueSize, timeoutMs: $timeoutMs, maxRouteHopCount: $maxRouteHopCount, defaultRouteHopCount: $defaultRouteHopCount, maxTimestampBehindMs: $maxTimestampBehindMs, maxTimestampAheadMs: $maxTimestampAheadMs)';
} }
@override @override
@ -4573,11 +4573,11 @@ class _$_VeilidConfigRPC
..add(DiagnosticsProperty('type', 'VeilidConfigRPC')) ..add(DiagnosticsProperty('type', 'VeilidConfigRPC'))
..add(DiagnosticsProperty('concurrency', concurrency)) ..add(DiagnosticsProperty('concurrency', concurrency))
..add(DiagnosticsProperty('queueSize', queueSize)) ..add(DiagnosticsProperty('queueSize', queueSize))
..add(DiagnosticsProperty('maxTimestampBehindMs', maxTimestampBehindMs))
..add(DiagnosticsProperty('maxTimestampAheadMs', maxTimestampAheadMs))
..add(DiagnosticsProperty('timeoutMs', timeoutMs)) ..add(DiagnosticsProperty('timeoutMs', timeoutMs))
..add(DiagnosticsProperty('maxRouteHopCount', maxRouteHopCount)) ..add(DiagnosticsProperty('maxRouteHopCount', maxRouteHopCount))
..add(DiagnosticsProperty('defaultRouteHopCount', defaultRouteHopCount)); ..add(DiagnosticsProperty('defaultRouteHopCount', defaultRouteHopCount))
..add(DiagnosticsProperty('maxTimestampBehindMs', maxTimestampBehindMs))
..add(DiagnosticsProperty('maxTimestampAheadMs', maxTimestampAheadMs));
} }
@override @override
@ -4589,16 +4589,16 @@ class _$_VeilidConfigRPC
other.concurrency == concurrency) && other.concurrency == concurrency) &&
(identical(other.queueSize, queueSize) || (identical(other.queueSize, queueSize) ||
other.queueSize == queueSize) && other.queueSize == queueSize) &&
(identical(other.maxTimestampBehindMs, maxTimestampBehindMs) ||
other.maxTimestampBehindMs == maxTimestampBehindMs) &&
(identical(other.maxTimestampAheadMs, maxTimestampAheadMs) ||
other.maxTimestampAheadMs == maxTimestampAheadMs) &&
(identical(other.timeoutMs, timeoutMs) || (identical(other.timeoutMs, timeoutMs) ||
other.timeoutMs == timeoutMs) && other.timeoutMs == timeoutMs) &&
(identical(other.maxRouteHopCount, maxRouteHopCount) || (identical(other.maxRouteHopCount, maxRouteHopCount) ||
other.maxRouteHopCount == maxRouteHopCount) && other.maxRouteHopCount == maxRouteHopCount) &&
(identical(other.defaultRouteHopCount, defaultRouteHopCount) || (identical(other.defaultRouteHopCount, defaultRouteHopCount) ||
other.defaultRouteHopCount == defaultRouteHopCount)); other.defaultRouteHopCount == defaultRouteHopCount) &&
(identical(other.maxTimestampBehindMs, maxTimestampBehindMs) ||
other.maxTimestampBehindMs == maxTimestampBehindMs) &&
(identical(other.maxTimestampAheadMs, maxTimestampAheadMs) ||
other.maxTimestampAheadMs == maxTimestampAheadMs));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -4607,11 +4607,11 @@ class _$_VeilidConfigRPC
runtimeType, runtimeType,
concurrency, concurrency,
queueSize, queueSize,
maxTimestampBehindMs,
maxTimestampAheadMs,
timeoutMs, timeoutMs,
maxRouteHopCount, maxRouteHopCount,
defaultRouteHopCount); defaultRouteHopCount,
maxTimestampBehindMs,
maxTimestampAheadMs);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -4631,11 +4631,11 @@ abstract class _VeilidConfigRPC implements VeilidConfigRPC {
const factory _VeilidConfigRPC( const factory _VeilidConfigRPC(
{required final int concurrency, {required final int concurrency,
required final int queueSize, required final int queueSize,
final int? maxTimestampBehindMs,
final int? maxTimestampAheadMs,
required final int timeoutMs, required final int timeoutMs,
required final int maxRouteHopCount, required final int maxRouteHopCount,
required final int defaultRouteHopCount}) = _$_VeilidConfigRPC; required final int defaultRouteHopCount,
final int? maxTimestampBehindMs,
final int? maxTimestampAheadMs}) = _$_VeilidConfigRPC;
factory _VeilidConfigRPC.fromJson(Map<String, dynamic> json) = factory _VeilidConfigRPC.fromJson(Map<String, dynamic> json) =
_$_VeilidConfigRPC.fromJson; _$_VeilidConfigRPC.fromJson;
@ -4645,16 +4645,16 @@ abstract class _VeilidConfigRPC implements VeilidConfigRPC {
@override @override
int get queueSize; int get queueSize;
@override @override
int? get maxTimestampBehindMs;
@override
int? get maxTimestampAheadMs;
@override
int get timeoutMs; int get timeoutMs;
@override @override
int get maxRouteHopCount; int get maxRouteHopCount;
@override @override
int get defaultRouteHopCount; int get defaultRouteHopCount;
@override @override
int? get maxTimestampBehindMs;
@override
int? get maxTimestampAheadMs;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$_VeilidConfigRPCCopyWith<_$_VeilidConfigRPC> get copyWith => _$$_VeilidConfigRPCCopyWith<_$_VeilidConfigRPC> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -5016,7 +5016,6 @@ mixin _$VeilidConfigNetwork {
int get clientWhitelistTimeoutMs => throw _privateConstructorUsedError; int get clientWhitelistTimeoutMs => throw _privateConstructorUsedError;
int get reverseConnectionReceiptTimeMs => throw _privateConstructorUsedError; int get reverseConnectionReceiptTimeMs => throw _privateConstructorUsedError;
int get holePunchReceiptTimeMs => throw _privateConstructorUsedError; int get holePunchReceiptTimeMs => throw _privateConstructorUsedError;
String? get networkKeyPassword => throw _privateConstructorUsedError;
VeilidConfigRoutingTable get routingTable => VeilidConfigRoutingTable get routingTable =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
VeilidConfigRPC get rpc => throw _privateConstructorUsedError; VeilidConfigRPC get rpc => throw _privateConstructorUsedError;
@ -5027,6 +5026,7 @@ mixin _$VeilidConfigNetwork {
VeilidConfigTLS get tls => throw _privateConstructorUsedError; VeilidConfigTLS get tls => throw _privateConstructorUsedError;
VeilidConfigApplication get application => throw _privateConstructorUsedError; VeilidConfigApplication get application => throw _privateConstructorUsedError;
VeilidConfigProtocol get protocol => throw _privateConstructorUsedError; VeilidConfigProtocol get protocol => throw _privateConstructorUsedError;
String? get networkKeyPassword => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -5050,7 +5050,6 @@ abstract class $VeilidConfigNetworkCopyWith<$Res> {
int clientWhitelistTimeoutMs, int clientWhitelistTimeoutMs,
int reverseConnectionReceiptTimeMs, int reverseConnectionReceiptTimeMs,
int holePunchReceiptTimeMs, int holePunchReceiptTimeMs,
String? networkKeyPassword,
VeilidConfigRoutingTable routingTable, VeilidConfigRoutingTable routingTable,
VeilidConfigRPC rpc, VeilidConfigRPC rpc,
VeilidConfigDHT dht, VeilidConfigDHT dht,
@ -5059,7 +5058,8 @@ abstract class $VeilidConfigNetworkCopyWith<$Res> {
int restrictedNatRetries, int restrictedNatRetries,
VeilidConfigTLS tls, VeilidConfigTLS tls,
VeilidConfigApplication application, VeilidConfigApplication application,
VeilidConfigProtocol protocol}); VeilidConfigProtocol protocol,
String? networkKeyPassword});
$VeilidConfigRoutingTableCopyWith<$Res> get routingTable; $VeilidConfigRoutingTableCopyWith<$Res> get routingTable;
$VeilidConfigRPCCopyWith<$Res> get rpc; $VeilidConfigRPCCopyWith<$Res> get rpc;
@ -5091,7 +5091,6 @@ class _$VeilidConfigNetworkCopyWithImpl<$Res, $Val extends VeilidConfigNetwork>
Object? clientWhitelistTimeoutMs = null, Object? clientWhitelistTimeoutMs = null,
Object? reverseConnectionReceiptTimeMs = null, Object? reverseConnectionReceiptTimeMs = null,
Object? holePunchReceiptTimeMs = null, Object? holePunchReceiptTimeMs = null,
Object? networkKeyPassword = freezed,
Object? routingTable = null, Object? routingTable = null,
Object? rpc = null, Object? rpc = null,
Object? dht = null, Object? dht = null,
@ -5101,6 +5100,7 @@ class _$VeilidConfigNetworkCopyWithImpl<$Res, $Val extends VeilidConfigNetwork>
Object? tls = null, Object? tls = null,
Object? application = null, Object? application = null,
Object? protocol = null, Object? protocol = null,
Object? networkKeyPassword = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
connectionInitialTimeoutMs: null == connectionInitialTimeoutMs connectionInitialTimeoutMs: null == connectionInitialTimeoutMs
@ -5139,10 +5139,6 @@ class _$VeilidConfigNetworkCopyWithImpl<$Res, $Val extends VeilidConfigNetwork>
? _value.holePunchReceiptTimeMs ? _value.holePunchReceiptTimeMs
: holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable : holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable
as int, as int,
networkKeyPassword: freezed == networkKeyPassword
? _value.networkKeyPassword
: networkKeyPassword // ignore: cast_nullable_to_non_nullable
as String?,
routingTable: null == routingTable routingTable: null == routingTable
? _value.routingTable ? _value.routingTable
: routingTable // ignore: cast_nullable_to_non_nullable : routingTable // ignore: cast_nullable_to_non_nullable
@ -5179,6 +5175,10 @@ class _$VeilidConfigNetworkCopyWithImpl<$Res, $Val extends VeilidConfigNetwork>
? _value.protocol ? _value.protocol
: protocol // ignore: cast_nullable_to_non_nullable : protocol // ignore: cast_nullable_to_non_nullable
as VeilidConfigProtocol, as VeilidConfigProtocol,
networkKeyPassword: freezed == networkKeyPassword
? _value.networkKeyPassword
: networkKeyPassword // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val); ) as $Val);
} }
@ -5250,7 +5250,6 @@ abstract class _$$_VeilidConfigNetworkCopyWith<$Res>
int clientWhitelistTimeoutMs, int clientWhitelistTimeoutMs,
int reverseConnectionReceiptTimeMs, int reverseConnectionReceiptTimeMs,
int holePunchReceiptTimeMs, int holePunchReceiptTimeMs,
String? networkKeyPassword,
VeilidConfigRoutingTable routingTable, VeilidConfigRoutingTable routingTable,
VeilidConfigRPC rpc, VeilidConfigRPC rpc,
VeilidConfigDHT dht, VeilidConfigDHT dht,
@ -5259,7 +5258,8 @@ abstract class _$$_VeilidConfigNetworkCopyWith<$Res>
int restrictedNatRetries, int restrictedNatRetries,
VeilidConfigTLS tls, VeilidConfigTLS tls,
VeilidConfigApplication application, VeilidConfigApplication application,
VeilidConfigProtocol protocol}); VeilidConfigProtocol protocol,
String? networkKeyPassword});
@override @override
$VeilidConfigRoutingTableCopyWith<$Res> get routingTable; $VeilidConfigRoutingTableCopyWith<$Res> get routingTable;
@ -5295,7 +5295,6 @@ class __$$_VeilidConfigNetworkCopyWithImpl<$Res>
Object? clientWhitelistTimeoutMs = null, Object? clientWhitelistTimeoutMs = null,
Object? reverseConnectionReceiptTimeMs = null, Object? reverseConnectionReceiptTimeMs = null,
Object? holePunchReceiptTimeMs = null, Object? holePunchReceiptTimeMs = null,
Object? networkKeyPassword = freezed,
Object? routingTable = null, Object? routingTable = null,
Object? rpc = null, Object? rpc = null,
Object? dht = null, Object? dht = null,
@ -5305,6 +5304,7 @@ class __$$_VeilidConfigNetworkCopyWithImpl<$Res>
Object? tls = null, Object? tls = null,
Object? application = null, Object? application = null,
Object? protocol = null, Object? protocol = null,
Object? networkKeyPassword = freezed,
}) { }) {
return _then(_$_VeilidConfigNetwork( return _then(_$_VeilidConfigNetwork(
connectionInitialTimeoutMs: null == connectionInitialTimeoutMs connectionInitialTimeoutMs: null == connectionInitialTimeoutMs
@ -5343,10 +5343,6 @@ class __$$_VeilidConfigNetworkCopyWithImpl<$Res>
? _value.holePunchReceiptTimeMs ? _value.holePunchReceiptTimeMs
: holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable : holePunchReceiptTimeMs // ignore: cast_nullable_to_non_nullable
as int, as int,
networkKeyPassword: freezed == networkKeyPassword
? _value.networkKeyPassword
: networkKeyPassword // ignore: cast_nullable_to_non_nullable
as String?,
routingTable: null == routingTable routingTable: null == routingTable
? _value.routingTable ? _value.routingTable
: routingTable // ignore: cast_nullable_to_non_nullable : routingTable // ignore: cast_nullable_to_non_nullable
@ -5383,6 +5379,10 @@ class __$$_VeilidConfigNetworkCopyWithImpl<$Res>
? _value.protocol ? _value.protocol
: protocol // ignore: cast_nullable_to_non_nullable : protocol // ignore: cast_nullable_to_non_nullable
as VeilidConfigProtocol, as VeilidConfigProtocol,
networkKeyPassword: freezed == networkKeyPassword
? _value.networkKeyPassword
: networkKeyPassword // ignore: cast_nullable_to_non_nullable
as String?,
)); ));
} }
} }
@ -5402,7 +5402,6 @@ class _$_VeilidConfigNetwork
required this.clientWhitelistTimeoutMs, required this.clientWhitelistTimeoutMs,
required this.reverseConnectionReceiptTimeMs, required this.reverseConnectionReceiptTimeMs,
required this.holePunchReceiptTimeMs, required this.holePunchReceiptTimeMs,
this.networkKeyPassword,
required this.routingTable, required this.routingTable,
required this.rpc, required this.rpc,
required this.dht, required this.dht,
@ -5411,7 +5410,8 @@ class _$_VeilidConfigNetwork
required this.restrictedNatRetries, required this.restrictedNatRetries,
required this.tls, required this.tls,
required this.application, required this.application,
required this.protocol}); required this.protocol,
this.networkKeyPassword});
factory _$_VeilidConfigNetwork.fromJson(Map<String, dynamic> json) => factory _$_VeilidConfigNetwork.fromJson(Map<String, dynamic> json) =>
_$$_VeilidConfigNetworkFromJson(json); _$$_VeilidConfigNetworkFromJson(json);
@ -5435,8 +5435,6 @@ class _$_VeilidConfigNetwork
@override @override
final int holePunchReceiptTimeMs; final int holePunchReceiptTimeMs;
@override @override
final String? networkKeyPassword;
@override
final VeilidConfigRoutingTable routingTable; final VeilidConfigRoutingTable routingTable;
@override @override
final VeilidConfigRPC rpc; final VeilidConfigRPC rpc;
@ -5454,10 +5452,12 @@ class _$_VeilidConfigNetwork
final VeilidConfigApplication application; final VeilidConfigApplication application;
@override @override
final VeilidConfigProtocol protocol; final VeilidConfigProtocol protocol;
@override
final String? networkKeyPassword;
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'VeilidConfigNetwork(connectionInitialTimeoutMs: $connectionInitialTimeoutMs, connectionInactivityTimeoutMs: $connectionInactivityTimeoutMs, maxConnectionsPerIp4: $maxConnectionsPerIp4, maxConnectionsPerIp6Prefix: $maxConnectionsPerIp6Prefix, maxConnectionsPerIp6PrefixSize: $maxConnectionsPerIp6PrefixSize, maxConnectionFrequencyPerMin: $maxConnectionFrequencyPerMin, clientWhitelistTimeoutMs: $clientWhitelistTimeoutMs, reverseConnectionReceiptTimeMs: $reverseConnectionReceiptTimeMs, holePunchReceiptTimeMs: $holePunchReceiptTimeMs, networkKeyPassword: $networkKeyPassword, routingTable: $routingTable, rpc: $rpc, dht: $dht, upnp: $upnp, detectAddressChanges: $detectAddressChanges, restrictedNatRetries: $restrictedNatRetries, tls: $tls, application: $application, protocol: $protocol)'; return 'VeilidConfigNetwork(connectionInitialTimeoutMs: $connectionInitialTimeoutMs, connectionInactivityTimeoutMs: $connectionInactivityTimeoutMs, maxConnectionsPerIp4: $maxConnectionsPerIp4, maxConnectionsPerIp6Prefix: $maxConnectionsPerIp6Prefix, maxConnectionsPerIp6PrefixSize: $maxConnectionsPerIp6PrefixSize, maxConnectionFrequencyPerMin: $maxConnectionFrequencyPerMin, clientWhitelistTimeoutMs: $clientWhitelistTimeoutMs, reverseConnectionReceiptTimeMs: $reverseConnectionReceiptTimeMs, holePunchReceiptTimeMs: $holePunchReceiptTimeMs, routingTable: $routingTable, rpc: $rpc, dht: $dht, upnp: $upnp, detectAddressChanges: $detectAddressChanges, restrictedNatRetries: $restrictedNatRetries, tls: $tls, application: $application, protocol: $protocol, networkKeyPassword: $networkKeyPassword)';
} }
@override @override
@ -5482,7 +5482,6 @@ class _$_VeilidConfigNetwork
'reverseConnectionReceiptTimeMs', reverseConnectionReceiptTimeMs)) 'reverseConnectionReceiptTimeMs', reverseConnectionReceiptTimeMs))
..add( ..add(
DiagnosticsProperty('holePunchReceiptTimeMs', holePunchReceiptTimeMs)) DiagnosticsProperty('holePunchReceiptTimeMs', holePunchReceiptTimeMs))
..add(DiagnosticsProperty('networkKeyPassword', networkKeyPassword))
..add(DiagnosticsProperty('routingTable', routingTable)) ..add(DiagnosticsProperty('routingTable', routingTable))
..add(DiagnosticsProperty('rpc', rpc)) ..add(DiagnosticsProperty('rpc', rpc))
..add(DiagnosticsProperty('dht', dht)) ..add(DiagnosticsProperty('dht', dht))
@ -5491,7 +5490,8 @@ class _$_VeilidConfigNetwork
..add(DiagnosticsProperty('restrictedNatRetries', restrictedNatRetries)) ..add(DiagnosticsProperty('restrictedNatRetries', restrictedNatRetries))
..add(DiagnosticsProperty('tls', tls)) ..add(DiagnosticsProperty('tls', tls))
..add(DiagnosticsProperty('application', application)) ..add(DiagnosticsProperty('application', application))
..add(DiagnosticsProperty('protocol', protocol)); ..add(DiagnosticsProperty('protocol', protocol))
..add(DiagnosticsProperty('networkKeyPassword', networkKeyPassword));
} }
@override @override
@ -5524,8 +5524,6 @@ class _$_VeilidConfigNetwork
reverseConnectionReceiptTimeMs) && reverseConnectionReceiptTimeMs) &&
(identical(other.holePunchReceiptTimeMs, holePunchReceiptTimeMs) || (identical(other.holePunchReceiptTimeMs, holePunchReceiptTimeMs) ||
other.holePunchReceiptTimeMs == holePunchReceiptTimeMs) && other.holePunchReceiptTimeMs == holePunchReceiptTimeMs) &&
(identical(other.networkKeyPassword, networkKeyPassword) ||
other.networkKeyPassword == networkKeyPassword) &&
(identical(other.routingTable, routingTable) || (identical(other.routingTable, routingTable) ||
other.routingTable == routingTable) && other.routingTable == routingTable) &&
(identical(other.rpc, rpc) || other.rpc == rpc) && (identical(other.rpc, rpc) || other.rpc == rpc) &&
@ -5539,7 +5537,9 @@ class _$_VeilidConfigNetwork
(identical(other.application, application) || (identical(other.application, application) ||
other.application == application) && other.application == application) &&
(identical(other.protocol, protocol) || (identical(other.protocol, protocol) ||
other.protocol == protocol)); other.protocol == protocol) &&
(identical(other.networkKeyPassword, networkKeyPassword) ||
other.networkKeyPassword == networkKeyPassword));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -5555,7 +5555,6 @@ class _$_VeilidConfigNetwork
clientWhitelistTimeoutMs, clientWhitelistTimeoutMs,
reverseConnectionReceiptTimeMs, reverseConnectionReceiptTimeMs,
holePunchReceiptTimeMs, holePunchReceiptTimeMs,
networkKeyPassword,
routingTable, routingTable,
rpc, rpc,
dht, dht,
@ -5564,7 +5563,8 @@ class _$_VeilidConfigNetwork
restrictedNatRetries, restrictedNatRetries,
tls, tls,
application, application,
protocol protocol,
networkKeyPassword
]); ]);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -5593,7 +5593,6 @@ abstract class _VeilidConfigNetwork implements VeilidConfigNetwork {
required final int clientWhitelistTimeoutMs, required final int clientWhitelistTimeoutMs,
required final int reverseConnectionReceiptTimeMs, required final int reverseConnectionReceiptTimeMs,
required final int holePunchReceiptTimeMs, required final int holePunchReceiptTimeMs,
final String? networkKeyPassword,
required final VeilidConfigRoutingTable routingTable, required final VeilidConfigRoutingTable routingTable,
required final VeilidConfigRPC rpc, required final VeilidConfigRPC rpc,
required final VeilidConfigDHT dht, required final VeilidConfigDHT dht,
@ -5602,7 +5601,8 @@ abstract class _VeilidConfigNetwork implements VeilidConfigNetwork {
required final int restrictedNatRetries, required final int restrictedNatRetries,
required final VeilidConfigTLS tls, required final VeilidConfigTLS tls,
required final VeilidConfigApplication application, required final VeilidConfigApplication application,
required final VeilidConfigProtocol protocol}) = _$_VeilidConfigNetwork; required final VeilidConfigProtocol protocol,
final String? networkKeyPassword}) = _$_VeilidConfigNetwork;
factory _VeilidConfigNetwork.fromJson(Map<String, dynamic> json) = factory _VeilidConfigNetwork.fromJson(Map<String, dynamic> json) =
_$_VeilidConfigNetwork.fromJson; _$_VeilidConfigNetwork.fromJson;
@ -5626,8 +5626,6 @@ abstract class _VeilidConfigNetwork implements VeilidConfigNetwork {
@override @override
int get holePunchReceiptTimeMs; int get holePunchReceiptTimeMs;
@override @override
String? get networkKeyPassword;
@override
VeilidConfigRoutingTable get routingTable; VeilidConfigRoutingTable get routingTable;
@override @override
VeilidConfigRPC get rpc; VeilidConfigRPC get rpc;
@ -5646,6 +5644,8 @@ abstract class _VeilidConfigNetwork implements VeilidConfigNetwork {
@override @override
VeilidConfigProtocol get protocol; VeilidConfigProtocol get protocol;
@override @override
String? get networkKeyPassword;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$_VeilidConfigNetworkCopyWith<_$_VeilidConfigNetwork> get copyWith => _$$_VeilidConfigNetworkCopyWith<_$_VeilidConfigNetwork> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;

View File

@ -55,12 +55,9 @@ Map<String, dynamic> _$$_VeilidFFIConfigLoggingApiToJson(
_$_VeilidFFIConfigLogging _$$_VeilidFFIConfigLoggingFromJson( _$_VeilidFFIConfigLogging _$$_VeilidFFIConfigLoggingFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_VeilidFFIConfigLogging( _$_VeilidFFIConfigLogging(
terminal: VeilidFFIConfigLoggingTerminal.fromJson( terminal: VeilidFFIConfigLoggingTerminal.fromJson(json['terminal']),
json['terminal'] as Map<String, dynamic>), otlp: VeilidFFIConfigLoggingOtlp.fromJson(json['otlp']),
otlp: VeilidFFIConfigLoggingOtlp.fromJson( api: VeilidFFIConfigLoggingApi.fromJson(json['api']),
json['otlp'] as Map<String, dynamic>),
api: VeilidFFIConfigLoggingApi.fromJson(
json['api'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidFFIConfigLoggingToJson( Map<String, dynamic> _$$_VeilidFFIConfigLoggingToJson(
@ -73,8 +70,7 @@ Map<String, dynamic> _$$_VeilidFFIConfigLoggingToJson(
_$_VeilidFFIConfig _$$_VeilidFFIConfigFromJson(Map<String, dynamic> json) => _$_VeilidFFIConfig _$$_VeilidFFIConfigFromJson(Map<String, dynamic> json) =>
_$_VeilidFFIConfig( _$_VeilidFFIConfig(
logging: VeilidFFIConfigLogging.fromJson( logging: VeilidFFIConfigLogging.fromJson(json['logging']),
json['logging'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidFFIConfigToJson(_$_VeilidFFIConfig instance) => Map<String, dynamic> _$$_VeilidFFIConfigToJson(_$_VeilidFFIConfig instance) =>
@ -117,10 +113,9 @@ Map<String, dynamic> _$$_VeilidWASMConfigLoggingApiToJson(
_$_VeilidWASMConfigLogging _$$_VeilidWASMConfigLoggingFromJson( _$_VeilidWASMConfigLogging _$$_VeilidWASMConfigLoggingFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_VeilidWASMConfigLogging( _$_VeilidWASMConfigLogging(
performance: VeilidWASMConfigLoggingPerformance.fromJson( performance:
json['performance'] as Map<String, dynamic>), VeilidWASMConfigLoggingPerformance.fromJson(json['performance']),
api: VeilidWASMConfigLoggingApi.fromJson( api: VeilidWASMConfigLoggingApi.fromJson(json['api']),
json['api'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidWASMConfigLoggingToJson( Map<String, dynamic> _$$_VeilidWASMConfigLoggingToJson(
@ -132,8 +127,7 @@ Map<String, dynamic> _$$_VeilidWASMConfigLoggingToJson(
_$_VeilidWASMConfig _$$_VeilidWASMConfigFromJson(Map<String, dynamic> json) => _$_VeilidWASMConfig _$$_VeilidWASMConfigFromJson(Map<String, dynamic> json) =>
_$_VeilidWASMConfig( _$_VeilidWASMConfig(
logging: VeilidWASMConfigLogging.fromJson( logging: VeilidWASMConfigLogging.fromJson(json['logging']),
json['logging'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidWASMConfigToJson(_$_VeilidWASMConfig instance) => Map<String, dynamic> _$$_VeilidWASMConfigToJson(_$_VeilidWASMConfig instance) =>
@ -177,8 +171,8 @@ Map<String, dynamic> _$$_VeilidConfigHTTPToJson(_$_VeilidConfigHTTP instance) =>
_$_VeilidConfigApplication _$$_VeilidConfigApplicationFromJson( _$_VeilidConfigApplication _$$_VeilidConfigApplicationFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_VeilidConfigApplication( _$_VeilidConfigApplication(
https: VeilidConfigHTTPS.fromJson(json['https'] as Map<String, dynamic>), https: VeilidConfigHTTPS.fromJson(json['https']),
http: VeilidConfigHTTP.fromJson(json['http'] as Map<String, dynamic>), http: VeilidConfigHTTP.fromJson(json['http']),
); );
Map<String, dynamic> _$$_VeilidConfigApplicationToJson( Map<String, dynamic> _$$_VeilidConfigApplicationToJson(
@ -265,10 +259,10 @@ Map<String, dynamic> _$$_VeilidConfigWSSToJson(_$_VeilidConfigWSS instance) =>
_$_VeilidConfigProtocol _$$_VeilidConfigProtocolFromJson( _$_VeilidConfigProtocol _$$_VeilidConfigProtocolFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_VeilidConfigProtocol( _$_VeilidConfigProtocol(
udp: VeilidConfigUDP.fromJson(json['udp'] as Map<String, dynamic>), udp: VeilidConfigUDP.fromJson(json['udp']),
tcp: VeilidConfigTCP.fromJson(json['tcp'] as Map<String, dynamic>), tcp: VeilidConfigTCP.fromJson(json['tcp']),
ws: VeilidConfigWS.fromJson(json['ws'] as Map<String, dynamic>), ws: VeilidConfigWS.fromJson(json['ws']),
wss: VeilidConfigWSS.fromJson(json['wss'] as Map<String, dynamic>), wss: VeilidConfigWSS.fromJson(json['wss']),
); );
Map<String, dynamic> _$$_VeilidConfigProtocolToJson( Map<String, dynamic> _$$_VeilidConfigProtocolToJson(
@ -349,22 +343,22 @@ _$_VeilidConfigRPC _$$_VeilidConfigRPCFromJson(Map<String, dynamic> json) =>
_$_VeilidConfigRPC( _$_VeilidConfigRPC(
concurrency: json['concurrency'] as int, concurrency: json['concurrency'] as int,
queueSize: json['queue_size'] as int, queueSize: json['queue_size'] as int,
maxTimestampBehindMs: json['max_timestamp_behind_ms'] as int?,
maxTimestampAheadMs: json['max_timestamp_ahead_ms'] as int?,
timeoutMs: json['timeout_ms'] as int, timeoutMs: json['timeout_ms'] as int,
maxRouteHopCount: json['max_route_hop_count'] as int, maxRouteHopCount: json['max_route_hop_count'] as int,
defaultRouteHopCount: json['default_route_hop_count'] as int, defaultRouteHopCount: json['default_route_hop_count'] as int,
maxTimestampBehindMs: json['max_timestamp_behind_ms'] as int?,
maxTimestampAheadMs: json['max_timestamp_ahead_ms'] as int?,
); );
Map<String, dynamic> _$$_VeilidConfigRPCToJson(_$_VeilidConfigRPC instance) => Map<String, dynamic> _$$_VeilidConfigRPCToJson(_$_VeilidConfigRPC instance) =>
<String, dynamic>{ <String, dynamic>{
'concurrency': instance.concurrency, 'concurrency': instance.concurrency,
'queue_size': instance.queueSize, 'queue_size': instance.queueSize,
'max_timestamp_behind_ms': instance.maxTimestampBehindMs,
'max_timestamp_ahead_ms': instance.maxTimestampAheadMs,
'timeout_ms': instance.timeoutMs, 'timeout_ms': instance.timeoutMs,
'max_route_hop_count': instance.maxRouteHopCount, 'max_route_hop_count': instance.maxRouteHopCount,
'default_route_hop_count': instance.defaultRouteHopCount, 'default_route_hop_count': instance.defaultRouteHopCount,
'max_timestamp_behind_ms': instance.maxTimestampBehindMs,
'max_timestamp_ahead_ms': instance.maxTimestampAheadMs,
}; };
_$_VeilidConfigRoutingTable _$$_VeilidConfigRoutingTableFromJson( _$_VeilidConfigRoutingTable _$$_VeilidConfigRoutingTableFromJson(
@ -414,19 +408,16 @@ _$_VeilidConfigNetwork _$$_VeilidConfigNetworkFromJson(
reverseConnectionReceiptTimeMs: reverseConnectionReceiptTimeMs:
json['reverse_connection_receipt_time_ms'] as int, json['reverse_connection_receipt_time_ms'] as int,
holePunchReceiptTimeMs: json['hole_punch_receipt_time_ms'] as int, holePunchReceiptTimeMs: json['hole_punch_receipt_time_ms'] as int,
networkKeyPassword: json['network_key_password'] as String?, routingTable: VeilidConfigRoutingTable.fromJson(json['routing_table']),
routingTable: VeilidConfigRoutingTable.fromJson( rpc: VeilidConfigRPC.fromJson(json['rpc']),
json['routing_table'] as Map<String, dynamic>), dht: VeilidConfigDHT.fromJson(json['dht']),
rpc: VeilidConfigRPC.fromJson(json['rpc'] as Map<String, dynamic>),
dht: VeilidConfigDHT.fromJson(json['dht'] as Map<String, dynamic>),
upnp: json['upnp'] as bool, upnp: json['upnp'] as bool,
detectAddressChanges: json['detect_address_changes'] as bool, detectAddressChanges: json['detect_address_changes'] as bool,
restrictedNatRetries: json['restricted_nat_retries'] as int, restrictedNatRetries: json['restricted_nat_retries'] as int,
tls: VeilidConfigTLS.fromJson(json['tls'] as Map<String, dynamic>), tls: VeilidConfigTLS.fromJson(json['tls']),
application: VeilidConfigApplication.fromJson( application: VeilidConfigApplication.fromJson(json['application']),
json['application'] as Map<String, dynamic>), protocol: VeilidConfigProtocol.fromJson(json['protocol']),
protocol: VeilidConfigProtocol.fromJson( networkKeyPassword: json['network_key_password'] as String?,
json['protocol'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidConfigNetworkToJson( Map<String, dynamic> _$$_VeilidConfigNetworkToJson(
@ -444,7 +435,6 @@ Map<String, dynamic> _$$_VeilidConfigNetworkToJson(
'reverse_connection_receipt_time_ms': 'reverse_connection_receipt_time_ms':
instance.reverseConnectionReceiptTimeMs, instance.reverseConnectionReceiptTimeMs,
'hole_punch_receipt_time_ms': instance.holePunchReceiptTimeMs, 'hole_punch_receipt_time_ms': instance.holePunchReceiptTimeMs,
'network_key_password': instance.networkKeyPassword,
'routing_table': instance.routingTable.toJson(), 'routing_table': instance.routingTable.toJson(),
'rpc': instance.rpc.toJson(), 'rpc': instance.rpc.toJson(),
'dht': instance.dht.toJson(), 'dht': instance.dht.toJson(),
@ -454,6 +444,7 @@ Map<String, dynamic> _$$_VeilidConfigNetworkToJson(
'tls': instance.tls.toJson(), 'tls': instance.tls.toJson(),
'application': instance.application.toJson(), 'application': instance.application.toJson(),
'protocol': instance.protocol.toJson(), 'protocol': instance.protocol.toJson(),
'network_key_password': instance.networkKeyPassword,
}; };
_$_VeilidConfigTableStore _$$_VeilidConfigTableStoreFromJson( _$_VeilidConfigTableStore _$$_VeilidConfigTableStoreFromJson(
@ -526,16 +517,12 @@ _$_VeilidConfig _$$_VeilidConfigFromJson(Map<String, dynamic> json) =>
_$_VeilidConfig( _$_VeilidConfig(
programName: json['program_name'] as String, programName: json['program_name'] as String,
namespace: json['namespace'] as String, namespace: json['namespace'] as String,
capabilities: VeilidConfigCapabilities.fromJson( capabilities: VeilidConfigCapabilities.fromJson(json['capabilities']),
json['capabilities'] as Map<String, dynamic>), protectedStore:
protectedStore: VeilidConfigProtectedStore.fromJson( VeilidConfigProtectedStore.fromJson(json['protected_store']),
json['protected_store'] as Map<String, dynamic>), tableStore: VeilidConfigTableStore.fromJson(json['table_store']),
tableStore: VeilidConfigTableStore.fromJson( blockStore: VeilidConfigBlockStore.fromJson(json['block_store']),
json['table_store'] as Map<String, dynamic>), network: VeilidConfigNetwork.fromJson(json['network']),
blockStore: VeilidConfigBlockStore.fromJson(
json['block_store'] as Map<String, dynamic>),
network:
VeilidConfigNetwork.fromJson(json['network'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidConfigToJson(_$_VeilidConfig instance) => Map<String, dynamic> _$$_VeilidConfigToJson(_$_VeilidConfig instance) =>

View File

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:charcode/charcode.dart'; import 'package:charcode/charcode.dart';
@ -12,9 +13,9 @@ import 'veilid.dart';
typedef CryptoKind = int; typedef CryptoKind = int;
const CryptoKind cryptoKindVLD0 = const CryptoKind cryptoKindVLD0 =
$V << 0 | $L << 8 | $D << 16 | $0 << 24; // "VLD0" $V << 24 | $L << 16 | $D << 8 | $0 << 0; // "VLD0"
const CryptoKind cryptoKindNONE = const CryptoKind cryptoKindNONE =
$N << 0 | $O << 8 | $N << 16 | $E << 24; // "NONE" $N << 24 | $O << 16 | $N << 8 | $E << 0; // "NONE"
String cryptoKindToString(CryptoKind kind) => String cryptoKindToString(CryptoKind kind) =>
cryptoKindToBytes(kind).map(String.fromCharCode).join(); cryptoKindToBytes(kind).map(String.fromCharCode).join();
@ -184,4 +185,49 @@ abstract class VeilidCryptoSystem {
SharedSecret sharedSecret, Uint8List? associatedData); SharedSecret sharedSecret, Uint8List? associatedData);
Future<Uint8List> cryptNoAuth( Future<Uint8List> cryptNoAuth(
Uint8List body, Nonce nonce, SharedSecret sharedSecret); Uint8List body, Nonce nonce, SharedSecret sharedSecret);
Future<Uint8List> encryptNoAuthWithNonce(
Uint8List body, SharedSecret secret) async {
// generate nonce
final nonce = await randomNonce();
// crypt and append nonce
final b = BytesBuilder()
..add(await cryptNoAuth(body, nonce, secret))
..add(nonce.decode());
return b.toBytes();
}
Future<Uint8List> decryptNoAuthWithNonce(
Uint8List body, SharedSecret secret) async {
if (body.length < Nonce.decodedLength()) {
throw const FormatException('not enough data to decrypt');
}
final nonce =
Nonce.fromBytes(body.sublist(body.length - Nonce.decodedLength()));
final encryptedData = body.sublist(0, body.length - Nonce.decodedLength());
// decrypt
return cryptNoAuth(encryptedData, nonce, secret);
}
Future<Uint8List> encryptNoAuthWithPassword(
Uint8List body, String password) async {
final ekbytes = Uint8List.fromList(utf8.encode(password));
final nonce = await randomNonce();
final saltBytes = nonce.decode();
final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes);
return (await cryptNoAuth(body, nonce, sharedSecret))..addAll(saltBytes);
}
Future<Uint8List> decryptNoAuthWithPassword(
Uint8List body, String password) async {
if (body.length < Nonce.decodedLength()) {
throw const FormatException('not enough data to decrypt');
}
final ekbytes = Uint8List.fromList(utf8.encode(password));
final bodyBytes = body.sublist(0, body.length - Nonce.decodedLength());
final saltBytes = body.sublist(body.length - Nonce.decodedLength());
final nonce = Nonce.fromBytes(saltBytes);
final sharedSecret = await deriveSharedSecret(ekbytes, saltBytes);
return cryptNoAuth(bodyBytes, nonce, sharedSecret);
}
} }

View File

@ -866,8 +866,8 @@ PeerStats _$PeerStatsFromJson(Map<String, dynamic> json) {
mixin _$PeerStats { mixin _$PeerStats {
Timestamp get timeAdded => throw _privateConstructorUsedError; Timestamp get timeAdded => throw _privateConstructorUsedError;
RPCStats get rpcStats => throw _privateConstructorUsedError; RPCStats get rpcStats => throw _privateConstructorUsedError;
LatencyStats? get latency => throw _privateConstructorUsedError;
TransferStatsDownUp get transfer => throw _privateConstructorUsedError; TransferStatsDownUp get transfer => throw _privateConstructorUsedError;
LatencyStats? get latency => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@ -883,12 +883,12 @@ abstract class $PeerStatsCopyWith<$Res> {
$Res call( $Res call(
{Timestamp timeAdded, {Timestamp timeAdded,
RPCStats rpcStats, RPCStats rpcStats,
LatencyStats? latency, TransferStatsDownUp transfer,
TransferStatsDownUp transfer}); LatencyStats? latency});
$RPCStatsCopyWith<$Res> get rpcStats; $RPCStatsCopyWith<$Res> get rpcStats;
$LatencyStatsCopyWith<$Res>? get latency;
$TransferStatsDownUpCopyWith<$Res> get transfer; $TransferStatsDownUpCopyWith<$Res> get transfer;
$LatencyStatsCopyWith<$Res>? get latency;
} }
/// @nodoc /// @nodoc
@ -906,8 +906,8 @@ class _$PeerStatsCopyWithImpl<$Res, $Val extends PeerStats>
$Res call({ $Res call({
Object? timeAdded = null, Object? timeAdded = null,
Object? rpcStats = null, Object? rpcStats = null,
Object? latency = freezed,
Object? transfer = null, Object? transfer = null,
Object? latency = freezed,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
timeAdded: null == timeAdded timeAdded: null == timeAdded
@ -918,14 +918,14 @@ class _$PeerStatsCopyWithImpl<$Res, $Val extends PeerStats>
? _value.rpcStats ? _value.rpcStats
: rpcStats // ignore: cast_nullable_to_non_nullable : rpcStats // ignore: cast_nullable_to_non_nullable
as RPCStats, as RPCStats,
latency: freezed == latency
? _value.latency
: latency // ignore: cast_nullable_to_non_nullable
as LatencyStats?,
transfer: null == transfer transfer: null == transfer
? _value.transfer ? _value.transfer
: transfer // ignore: cast_nullable_to_non_nullable : transfer // ignore: cast_nullable_to_non_nullable
as TransferStatsDownUp, as TransferStatsDownUp,
latency: freezed == latency
? _value.latency
: latency // ignore: cast_nullable_to_non_nullable
as LatencyStats?,
) as $Val); ) as $Val);
} }
@ -937,6 +937,14 @@ class _$PeerStatsCopyWithImpl<$Res, $Val extends PeerStats>
}); });
} }
@override
@pragma('vm:prefer-inline')
$TransferStatsDownUpCopyWith<$Res> get transfer {
return $TransferStatsDownUpCopyWith<$Res>(_value.transfer, (value) {
return _then(_value.copyWith(transfer: value) as $Val);
});
}
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$LatencyStatsCopyWith<$Res>? get latency { $LatencyStatsCopyWith<$Res>? get latency {
@ -948,14 +956,6 @@ class _$PeerStatsCopyWithImpl<$Res, $Val extends PeerStats>
return _then(_value.copyWith(latency: value) as $Val); return _then(_value.copyWith(latency: value) as $Val);
}); });
} }
@override
@pragma('vm:prefer-inline')
$TransferStatsDownUpCopyWith<$Res> get transfer {
return $TransferStatsDownUpCopyWith<$Res>(_value.transfer, (value) {
return _then(_value.copyWith(transfer: value) as $Val);
});
}
} }
/// @nodoc /// @nodoc
@ -968,15 +968,15 @@ abstract class _$$_PeerStatsCopyWith<$Res> implements $PeerStatsCopyWith<$Res> {
$Res call( $Res call(
{Timestamp timeAdded, {Timestamp timeAdded,
RPCStats rpcStats, RPCStats rpcStats,
LatencyStats? latency, TransferStatsDownUp transfer,
TransferStatsDownUp transfer}); LatencyStats? latency});
@override @override
$RPCStatsCopyWith<$Res> get rpcStats; $RPCStatsCopyWith<$Res> get rpcStats;
@override @override
$LatencyStatsCopyWith<$Res>? get latency;
@override
$TransferStatsDownUpCopyWith<$Res> get transfer; $TransferStatsDownUpCopyWith<$Res> get transfer;
@override
$LatencyStatsCopyWith<$Res>? get latency;
} }
/// @nodoc /// @nodoc
@ -992,8 +992,8 @@ class __$$_PeerStatsCopyWithImpl<$Res>
$Res call({ $Res call({
Object? timeAdded = null, Object? timeAdded = null,
Object? rpcStats = null, Object? rpcStats = null,
Object? latency = freezed,
Object? transfer = null, Object? transfer = null,
Object? latency = freezed,
}) { }) {
return _then(_$_PeerStats( return _then(_$_PeerStats(
timeAdded: null == timeAdded timeAdded: null == timeAdded
@ -1004,14 +1004,14 @@ class __$$_PeerStatsCopyWithImpl<$Res>
? _value.rpcStats ? _value.rpcStats
: rpcStats // ignore: cast_nullable_to_non_nullable : rpcStats // ignore: cast_nullable_to_non_nullable
as RPCStats, as RPCStats,
latency: freezed == latency
? _value.latency
: latency // ignore: cast_nullable_to_non_nullable
as LatencyStats?,
transfer: null == transfer transfer: null == transfer
? _value.transfer ? _value.transfer
: transfer // ignore: cast_nullable_to_non_nullable : transfer // ignore: cast_nullable_to_non_nullable
as TransferStatsDownUp, as TransferStatsDownUp,
latency: freezed == latency
? _value.latency
: latency // ignore: cast_nullable_to_non_nullable
as LatencyStats?,
)); ));
} }
} }
@ -1022,8 +1022,8 @@ class _$_PeerStats implements _PeerStats {
const _$_PeerStats( const _$_PeerStats(
{required this.timeAdded, {required this.timeAdded,
required this.rpcStats, required this.rpcStats,
this.latency, required this.transfer,
required this.transfer}); this.latency});
factory _$_PeerStats.fromJson(Map<String, dynamic> json) => factory _$_PeerStats.fromJson(Map<String, dynamic> json) =>
_$$_PeerStatsFromJson(json); _$$_PeerStatsFromJson(json);
@ -1033,13 +1033,13 @@ class _$_PeerStats implements _PeerStats {
@override @override
final RPCStats rpcStats; final RPCStats rpcStats;
@override @override
final LatencyStats? latency;
@override
final TransferStatsDownUp transfer; final TransferStatsDownUp transfer;
@override
final LatencyStats? latency;
@override @override
String toString() { String toString() {
return 'PeerStats(timeAdded: $timeAdded, rpcStats: $rpcStats, latency: $latency, transfer: $transfer)'; return 'PeerStats(timeAdded: $timeAdded, rpcStats: $rpcStats, transfer: $transfer, latency: $latency)';
} }
@override @override
@ -1051,15 +1051,15 @@ class _$_PeerStats implements _PeerStats {
other.timeAdded == timeAdded) && other.timeAdded == timeAdded) &&
(identical(other.rpcStats, rpcStats) || (identical(other.rpcStats, rpcStats) ||
other.rpcStats == rpcStats) && other.rpcStats == rpcStats) &&
(identical(other.latency, latency) || other.latency == latency) &&
(identical(other.transfer, transfer) || (identical(other.transfer, transfer) ||
other.transfer == transfer)); other.transfer == transfer) &&
(identical(other.latency, latency) || other.latency == latency));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => int get hashCode =>
Object.hash(runtimeType, timeAdded, rpcStats, latency, transfer); Object.hash(runtimeType, timeAdded, rpcStats, transfer, latency);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -1079,8 +1079,8 @@ abstract class _PeerStats implements PeerStats {
const factory _PeerStats( const factory _PeerStats(
{required final Timestamp timeAdded, {required final Timestamp timeAdded,
required final RPCStats rpcStats, required final RPCStats rpcStats,
final LatencyStats? latency, required final TransferStatsDownUp transfer,
required final TransferStatsDownUp transfer}) = _$_PeerStats; final LatencyStats? latency}) = _$_PeerStats;
factory _PeerStats.fromJson(Map<String, dynamic> json) = factory _PeerStats.fromJson(Map<String, dynamic> json) =
_$_PeerStats.fromJson; _$_PeerStats.fromJson;
@ -1090,10 +1090,10 @@ abstract class _PeerStats implements PeerStats {
@override @override
RPCStats get rpcStats; RPCStats get rpcStats;
@override @override
LatencyStats? get latency;
@override
TransferStatsDownUp get transfer; TransferStatsDownUp get transfer;
@override @override
LatencyStats? get latency;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$_PeerStatsCopyWith<_$_PeerStats> get copyWith => _$$_PeerStatsCopyWith<_$_PeerStats> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -1335,11 +1335,11 @@ mixin _$VeilidUpdate {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1361,11 +1361,11 @@ mixin _$VeilidUpdate {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1386,11 +1386,11 @@ mixin _$VeilidUpdate {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1562,11 +1562,11 @@ class _$VeilidLog implements VeilidLog {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1591,11 +1591,11 @@ class _$VeilidLog implements VeilidLog {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1619,11 +1619,11 @@ class _$VeilidLog implements VeilidLog {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1725,8 +1725,8 @@ abstract class _$$VeilidAppMessageCopyWith<$Res> {
__$$VeilidAppMessageCopyWithImpl<$Res>; __$$VeilidAppMessageCopyWithImpl<$Res>;
@useResult @useResult
$Res call( $Res call(
{Typed<FixedEncodedString43>? sender, {@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message}); Typed<FixedEncodedString43>? sender});
} }
/// @nodoc /// @nodoc
@ -1740,18 +1740,18 @@ class __$$VeilidAppMessageCopyWithImpl<$Res>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? sender = freezed,
Object? message = null, Object? message = null,
Object? sender = freezed,
}) { }) {
return _then(_$VeilidAppMessage( return _then(_$VeilidAppMessage(
sender: freezed == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?,
message: null == message message: null == message
? _value.message ? _value.message
: message // ignore: cast_nullable_to_non_nullable : message // ignore: cast_nullable_to_non_nullable
as Uint8List, as Uint8List,
sender: freezed == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?,
)); ));
} }
} }
@ -1760,26 +1760,26 @@ class __$$VeilidAppMessageCopyWithImpl<$Res>
@JsonSerializable() @JsonSerializable()
class _$VeilidAppMessage implements VeilidAppMessage { class _$VeilidAppMessage implements VeilidAppMessage {
const _$VeilidAppMessage( const _$VeilidAppMessage(
{this.sender, {@Uint8ListJsonConverter() required this.message,
@Uint8ListJsonConverter() required this.message, this.sender,
final String? $type}) final String? $type})
: $type = $type ?? 'AppMessage'; : $type = $type ?? 'AppMessage';
factory _$VeilidAppMessage.fromJson(Map<String, dynamic> json) => factory _$VeilidAppMessage.fromJson(Map<String, dynamic> json) =>
_$$VeilidAppMessageFromJson(json); _$$VeilidAppMessageFromJson(json);
@override
final Typed<FixedEncodedString43>? sender;
@override @override
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
final Uint8List message; final Uint8List message;
@override
final Typed<FixedEncodedString43>? sender;
@JsonKey(name: 'kind') @JsonKey(name: 'kind')
final String $type; final String $type;
@override @override
String toString() { String toString() {
return 'VeilidUpdate.appMessage(sender: $sender, message: $message)'; return 'VeilidUpdate.appMessage(message: $message, sender: $sender)';
} }
@override @override
@ -1787,14 +1787,14 @@ class _$VeilidAppMessage implements VeilidAppMessage {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$VeilidAppMessage && other is _$VeilidAppMessage &&
(identical(other.sender, sender) || other.sender == sender) && const DeepCollectionEquality().equals(other.message, message) &&
const DeepCollectionEquality().equals(other.message, message)); (identical(other.sender, sender) || other.sender == sender));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(
runtimeType, sender, const DeepCollectionEquality().hash(message)); runtimeType, const DeepCollectionEquality().hash(message), sender);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -1808,11 +1808,11 @@ class _$VeilidAppMessage implements VeilidAppMessage {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -1828,7 +1828,7 @@ class _$VeilidAppMessage implements VeilidAppMessage {
List<ValueSubkeyRange> subkeys, int count, ValueData valueData) List<ValueSubkeyRange> subkeys, int count, ValueData valueData)
valueChange, valueChange,
}) { }) {
return appMessage(sender, message); return appMessage(message, sender);
} }
@override @override
@ -1837,11 +1837,11 @@ class _$VeilidAppMessage implements VeilidAppMessage {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1856,7 +1856,7 @@ class _$VeilidAppMessage implements VeilidAppMessage {
List<ValueSubkeyRange> subkeys, int count, ValueData valueData)? List<ValueSubkeyRange> subkeys, int count, ValueData valueData)?
valueChange, valueChange,
}) { }) {
return appMessage?.call(sender, message); return appMessage?.call(message, sender);
} }
@override @override
@ -1865,11 +1865,11 @@ class _$VeilidAppMessage implements VeilidAppMessage {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -1886,7 +1886,7 @@ class _$VeilidAppMessage implements VeilidAppMessage {
required TResult orElse(), required TResult orElse(),
}) { }) {
if (appMessage != null) { if (appMessage != null) {
return appMessage(sender, message); return appMessage(message, sender);
} }
return orElse(); return orElse();
} }
@ -1950,16 +1950,15 @@ class _$VeilidAppMessage implements VeilidAppMessage {
abstract class VeilidAppMessage implements VeilidUpdate { abstract class VeilidAppMessage implements VeilidUpdate {
const factory VeilidAppMessage( const factory VeilidAppMessage(
{final Typed<FixedEncodedString43>? sender, {@Uint8ListJsonConverter() required final Uint8List message,
@Uint8ListJsonConverter() required final Uint8List message}) = final Typed<FixedEncodedString43>? sender}) = _$VeilidAppMessage;
_$VeilidAppMessage;
factory VeilidAppMessage.fromJson(Map<String, dynamic> json) = factory VeilidAppMessage.fromJson(Map<String, dynamic> json) =
_$VeilidAppMessage.fromJson; _$VeilidAppMessage.fromJson;
Typed<FixedEncodedString43>? get sender;
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List get message; Uint8List get message;
Typed<FixedEncodedString43>? get sender;
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$VeilidAppMessageCopyWith<_$VeilidAppMessage> get copyWith => _$$VeilidAppMessageCopyWith<_$VeilidAppMessage> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -1972,9 +1971,9 @@ abstract class _$$VeilidAppCallCopyWith<$Res> {
__$$VeilidAppCallCopyWithImpl<$Res>; __$$VeilidAppCallCopyWithImpl<$Res>;
@useResult @useResult
$Res call( $Res call(
{Typed<FixedEncodedString43>? sender, {@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId,
String callId}); Typed<FixedEncodedString43>? sender});
} }
/// @nodoc /// @nodoc
@ -1988,15 +1987,11 @@ class __$$VeilidAppCallCopyWithImpl<$Res>
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? sender = freezed,
Object? message = null, Object? message = null,
Object? callId = null, Object? callId = null,
Object? sender = freezed,
}) { }) {
return _then(_$VeilidAppCall( return _then(_$VeilidAppCall(
sender: freezed == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?,
message: null == message message: null == message
? _value.message ? _value.message
: message // ignore: cast_nullable_to_non_nullable : message // ignore: cast_nullable_to_non_nullable
@ -2005,6 +2000,10 @@ class __$$VeilidAppCallCopyWithImpl<$Res>
? _value.callId ? _value.callId
: callId // ignore: cast_nullable_to_non_nullable : callId // ignore: cast_nullable_to_non_nullable
as String, as String,
sender: freezed == sender
? _value.sender
: sender // ignore: cast_nullable_to_non_nullable
as Typed<FixedEncodedString43>?,
)); ));
} }
} }
@ -2013,29 +2012,29 @@ class __$$VeilidAppCallCopyWithImpl<$Res>
@JsonSerializable() @JsonSerializable()
class _$VeilidAppCall implements VeilidAppCall { class _$VeilidAppCall implements VeilidAppCall {
const _$VeilidAppCall( const _$VeilidAppCall(
{this.sender, {@Uint8ListJsonConverter() required this.message,
@Uint8ListJsonConverter() required this.message,
required this.callId, required this.callId,
this.sender,
final String? $type}) final String? $type})
: $type = $type ?? 'AppCall'; : $type = $type ?? 'AppCall';
factory _$VeilidAppCall.fromJson(Map<String, dynamic> json) => factory _$VeilidAppCall.fromJson(Map<String, dynamic> json) =>
_$$VeilidAppCallFromJson(json); _$$VeilidAppCallFromJson(json);
@override
final Typed<FixedEncodedString43>? sender;
@override @override
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
final Uint8List message; final Uint8List message;
@override @override
final String callId; final String callId;
@override
final Typed<FixedEncodedString43>? sender;
@JsonKey(name: 'kind') @JsonKey(name: 'kind')
final String $type; final String $type;
@override @override
String toString() { String toString() {
return 'VeilidUpdate.appCall(sender: $sender, message: $message, callId: $callId)'; return 'VeilidUpdate.appCall(message: $message, callId: $callId, sender: $sender)';
} }
@override @override
@ -2043,15 +2042,15 @@ class _$VeilidAppCall implements VeilidAppCall {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$VeilidAppCall && other is _$VeilidAppCall &&
(identical(other.sender, sender) || other.sender == sender) &&
const DeepCollectionEquality().equals(other.message, message) && const DeepCollectionEquality().equals(other.message, message) &&
(identical(other.callId, callId) || other.callId == callId)); (identical(other.callId, callId) || other.callId == callId) &&
(identical(other.sender, sender) || other.sender == sender));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
int get hashCode => Object.hash(runtimeType, sender, int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(message), callId); const DeepCollectionEquality().hash(message), callId, sender);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@ -2065,11 +2064,11 @@ class _$VeilidAppCall implements VeilidAppCall {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2085,7 +2084,7 @@ class _$VeilidAppCall implements VeilidAppCall {
List<ValueSubkeyRange> subkeys, int count, ValueData valueData) List<ValueSubkeyRange> subkeys, int count, ValueData valueData)
valueChange, valueChange,
}) { }) {
return appCall(sender, message, callId); return appCall(message, callId, sender);
} }
@override @override
@ -2094,11 +2093,11 @@ class _$VeilidAppCall implements VeilidAppCall {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2113,7 +2112,7 @@ class _$VeilidAppCall implements VeilidAppCall {
List<ValueSubkeyRange> subkeys, int count, ValueData valueData)? List<ValueSubkeyRange> subkeys, int count, ValueData valueData)?
valueChange, valueChange,
}) { }) {
return appCall?.call(sender, message, callId); return appCall?.call(message, callId, sender);
} }
@override @override
@ -2122,11 +2121,11 @@ class _$VeilidAppCall implements VeilidAppCall {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2143,7 +2142,7 @@ class _$VeilidAppCall implements VeilidAppCall {
required TResult orElse(), required TResult orElse(),
}) { }) {
if (appCall != null) { if (appCall != null) {
return appCall(sender, message, callId); return appCall(message, callId, sender);
} }
return orElse(); return orElse();
} }
@ -2207,17 +2206,17 @@ class _$VeilidAppCall implements VeilidAppCall {
abstract class VeilidAppCall implements VeilidUpdate { abstract class VeilidAppCall implements VeilidUpdate {
const factory VeilidAppCall( const factory VeilidAppCall(
{final Typed<FixedEncodedString43>? sender, {@Uint8ListJsonConverter() required final Uint8List message,
@Uint8ListJsonConverter() required final Uint8List message, required final String callId,
required final String callId}) = _$VeilidAppCall; final Typed<FixedEncodedString43>? sender}) = _$VeilidAppCall;
factory VeilidAppCall.fromJson(Map<String, dynamic> json) = factory VeilidAppCall.fromJson(Map<String, dynamic> json) =
_$VeilidAppCall.fromJson; _$VeilidAppCall.fromJson;
Typed<FixedEncodedString43>? get sender;
@Uint8ListJsonConverter() @Uint8ListJsonConverter()
Uint8List get message; Uint8List get message;
String get callId; String get callId;
Typed<FixedEncodedString43>? get sender;
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$VeilidAppCallCopyWith<_$VeilidAppCall> get copyWith => _$$VeilidAppCallCopyWith<_$VeilidAppCall> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;
@ -2325,11 +2324,11 @@ class _$VeilidUpdateAttachment implements VeilidUpdateAttachment {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2354,11 +2353,11 @@ class _$VeilidUpdateAttachment implements VeilidUpdateAttachment {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2382,11 +2381,11 @@ class _$VeilidUpdateAttachment implements VeilidUpdateAttachment {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2595,11 +2594,11 @@ class _$VeilidUpdateNetwork implements VeilidUpdateNetwork {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2624,11 +2623,11 @@ class _$VeilidUpdateNetwork implements VeilidUpdateNetwork {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2652,11 +2651,11 @@ class _$VeilidUpdateNetwork implements VeilidUpdateNetwork {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2840,11 +2839,11 @@ class _$VeilidUpdateConfig implements VeilidUpdateConfig {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -2869,11 +2868,11 @@ class _$VeilidUpdateConfig implements VeilidUpdateConfig {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -2897,11 +2896,11 @@ class _$VeilidUpdateConfig implements VeilidUpdateConfig {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3099,11 +3098,11 @@ class _$VeilidUpdateRouteChange implements VeilidUpdateRouteChange {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -3128,11 +3127,11 @@ class _$VeilidUpdateRouteChange implements VeilidUpdateRouteChange {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3156,11 +3155,11 @@ class _$VeilidUpdateRouteChange implements VeilidUpdateRouteChange {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3383,11 +3382,11 @@ class _$VeilidUpdateValueChange implements VeilidUpdateValueChange {
required TResult Function( required TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace) VeilidLogLevel logLevel, String message, String? backtrace)
log, log,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message) Typed<FixedEncodedString43>? sender)
appMessage, appMessage,
required TResult Function(Typed<FixedEncodedString43>? sender, required TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId) String callId, Typed<FixedEncodedString43>? sender)
appCall, appCall,
required TResult Function(AttachmentState state, bool publicInternetReady, required TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady) bool localNetworkReady)
@ -3412,11 +3411,11 @@ class _$VeilidUpdateValueChange implements VeilidUpdateValueChange {
TResult? Function( TResult? Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult? Function(Typed<FixedEncodedString43>? sender, TResult? Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message, String callId)? String callId, Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult? Function(AttachmentState state, bool publicInternetReady, TResult? Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?
@ -3440,11 +3439,11 @@ class _$VeilidUpdateValueChange implements VeilidUpdateValueChange {
TResult Function( TResult Function(
VeilidLogLevel logLevel, String message, String? backtrace)? VeilidLogLevel logLevel, String message, String? backtrace)?
log, log,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message,
@Uint8ListJsonConverter() Uint8List message)? Typed<FixedEncodedString43>? sender)?
appMessage, appMessage,
TResult Function(Typed<FixedEncodedString43>? sender, TResult Function(@Uint8ListJsonConverter() Uint8List message, String callId,
@Uint8ListJsonConverter() Uint8List message, String callId)? Typed<FixedEncodedString43>? sender)?
appCall, appCall,
TResult Function(AttachmentState state, bool publicInternetReady, TResult Function(AttachmentState state, bool publicInternetReady,
bool localNetworkReady)? bool localNetworkReady)?

View File

@ -39,8 +39,8 @@ Map<String, dynamic> _$$_TransferStatsToJson(_$_TransferStats instance) =>
_$_TransferStatsDownUp _$$_TransferStatsDownUpFromJson( _$_TransferStatsDownUp _$$_TransferStatsDownUpFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_TransferStatsDownUp( _$_TransferStatsDownUp(
down: TransferStats.fromJson(json['down'] as Map<String, dynamic>), down: TransferStats.fromJson(json['down']),
up: TransferStats.fromJson(json['up'] as Map<String, dynamic>), up: TransferStats.fromJson(json['up']),
); );
Map<String, dynamic> _$$_TransferStatsDownUpToJson( Map<String, dynamic> _$$_TransferStatsDownUpToJson(
@ -81,20 +81,19 @@ Map<String, dynamic> _$$_RPCStatsToJson(_$_RPCStats instance) =>
_$_PeerStats _$$_PeerStatsFromJson(Map<String, dynamic> json) => _$_PeerStats( _$_PeerStats _$$_PeerStatsFromJson(Map<String, dynamic> json) => _$_PeerStats(
timeAdded: Timestamp.fromJson(json['time_added']), timeAdded: Timestamp.fromJson(json['time_added']),
rpcStats: RPCStats.fromJson(json['rpc_stats'] as Map<String, dynamic>), rpcStats: RPCStats.fromJson(json['rpc_stats']),
transfer: TransferStatsDownUp.fromJson(json['transfer']),
latency: json['latency'] == null latency: json['latency'] == null
? null ? null
: LatencyStats.fromJson(json['latency'] as Map<String, dynamic>), : LatencyStats.fromJson(json['latency']),
transfer: TransferStatsDownUp.fromJson(
json['transfer'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_PeerStatsToJson(_$_PeerStats instance) => Map<String, dynamic> _$$_PeerStatsToJson(_$_PeerStats instance) =>
<String, dynamic>{ <String, dynamic>{
'time_added': instance.timeAdded.toJson(), 'time_added': instance.timeAdded.toJson(),
'rpc_stats': instance.rpcStats.toJson(), 'rpc_stats': instance.rpcStats.toJson(),
'latency': instance.latency?.toJson(),
'transfer': instance.transfer.toJson(), 'transfer': instance.transfer.toJson(),
'latency': instance.latency?.toJson(),
}; };
_$_PeerTableData _$$_PeerTableDataFromJson(Map<String, dynamic> json) => _$_PeerTableData _$$_PeerTableDataFromJson(Map<String, dynamic> json) =>
@ -103,7 +102,7 @@ _$_PeerTableData _$$_PeerTableDataFromJson(Map<String, dynamic> json) =>
.map(Typed<FixedEncodedString43>.fromJson) .map(Typed<FixedEncodedString43>.fromJson)
.toList(), .toList(),
peerAddress: json['peer_address'] as String, peerAddress: json['peer_address'] as String,
peerStats: PeerStats.fromJson(json['peer_stats'] as Map<String, dynamic>), peerStats: PeerStats.fromJson(json['peer_stats']),
); );
Map<String, dynamic> _$$_PeerTableDataToJson(_$_PeerTableData instance) => Map<String, dynamic> _$$_PeerTableDataToJson(_$_PeerTableData instance) =>
@ -114,7 +113,7 @@ Map<String, dynamic> _$$_PeerTableDataToJson(_$_PeerTableData instance) =>
}; };
_$VeilidLog _$$VeilidLogFromJson(Map<String, dynamic> json) => _$VeilidLog( _$VeilidLog _$$VeilidLogFromJson(Map<String, dynamic> json) => _$VeilidLog(
logLevel: VeilidLogLevel.fromJson(json['log_level'] as String), logLevel: VeilidLogLevel.fromJson(json['log_level']),
message: json['message'] as String, message: json['message'] as String,
backtrace: json['backtrace'] as String?, backtrace: json['backtrace'] as String?,
$type: json['kind'] as String?, $type: json['kind'] as String?,
@ -130,44 +129,44 @@ Map<String, dynamic> _$$VeilidLogToJson(_$VeilidLog instance) =>
_$VeilidAppMessage _$$VeilidAppMessageFromJson(Map<String, dynamic> json) => _$VeilidAppMessage _$$VeilidAppMessageFromJson(Map<String, dynamic> json) =>
_$VeilidAppMessage( _$VeilidAppMessage(
message:
const Uint8ListJsonConverter().fromJson(json['message'] as String),
sender: json['sender'] == null sender: json['sender'] == null
? null ? null
: Typed<FixedEncodedString43>.fromJson(json['sender']), : Typed<FixedEncodedString43>.fromJson(json['sender']),
message:
const Uint8ListJsonConverter().fromJson(json['message'] as String),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$$VeilidAppMessageToJson(_$VeilidAppMessage instance) => Map<String, dynamic> _$$VeilidAppMessageToJson(_$VeilidAppMessage instance) =>
<String, dynamic>{ <String, dynamic>{
'sender': instance.sender?.toJson(),
'message': const Uint8ListJsonConverter().toJson(instance.message), 'message': const Uint8ListJsonConverter().toJson(instance.message),
'sender': instance.sender?.toJson(),
'kind': instance.$type, 'kind': instance.$type,
}; };
_$VeilidAppCall _$$VeilidAppCallFromJson(Map<String, dynamic> json) => _$VeilidAppCall _$$VeilidAppCallFromJson(Map<String, dynamic> json) =>
_$VeilidAppCall( _$VeilidAppCall(
sender: json['sender'] == null
? null
: Typed<FixedEncodedString43>.fromJson(json['sender']),
message: message:
const Uint8ListJsonConverter().fromJson(json['message'] as String), const Uint8ListJsonConverter().fromJson(json['message'] as String),
callId: json['call_id'] as String, callId: json['call_id'] as String,
sender: json['sender'] == null
? null
: Typed<FixedEncodedString43>.fromJson(json['sender']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
Map<String, dynamic> _$$VeilidAppCallToJson(_$VeilidAppCall instance) => Map<String, dynamic> _$$VeilidAppCallToJson(_$VeilidAppCall instance) =>
<String, dynamic>{ <String, dynamic>{
'sender': instance.sender?.toJson(),
'message': const Uint8ListJsonConverter().toJson(instance.message), 'message': const Uint8ListJsonConverter().toJson(instance.message),
'call_id': instance.callId, 'call_id': instance.callId,
'sender': instance.sender?.toJson(),
'kind': instance.$type, 'kind': instance.$type,
}; };
_$VeilidUpdateAttachment _$$VeilidUpdateAttachmentFromJson( _$VeilidUpdateAttachment _$$VeilidUpdateAttachmentFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$VeilidUpdateAttachment( _$VeilidUpdateAttachment(
state: AttachmentState.fromJson(json['state'] as String), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
$type: json['kind'] as String?, $type: json['kind'] as String?,
@ -188,9 +187,8 @@ _$VeilidUpdateNetwork _$$VeilidUpdateNetworkFromJson(
started: json['started'] as bool, started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String), bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String), bpsUp: BigInt.parse(json['bps_up'] as String),
peers: (json['peers'] as List<dynamic>) peers:
.map((e) => PeerTableData.fromJson(e as Map<String, dynamic>)) (json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(),
.toList(),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -206,7 +204,7 @@ Map<String, dynamic> _$$VeilidUpdateNetworkToJson(
_$VeilidUpdateConfig _$$VeilidUpdateConfigFromJson(Map<String, dynamic> json) => _$VeilidUpdateConfig _$$VeilidUpdateConfigFromJson(Map<String, dynamic> json) =>
_$VeilidUpdateConfig( _$VeilidUpdateConfig(
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>), config: VeilidConfig.fromJson(json['config']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -242,10 +240,10 @@ _$VeilidUpdateValueChange _$$VeilidUpdateValueChangeFromJson(
_$VeilidUpdateValueChange( _$VeilidUpdateValueChange(
key: Typed<FixedEncodedString43>.fromJson(json['key']), key: Typed<FixedEncodedString43>.fromJson(json['key']),
subkeys: (json['subkeys'] as List<dynamic>) subkeys: (json['subkeys'] as List<dynamic>)
.map((e) => ValueSubkeyRange.fromJson(e as Map<String, dynamic>)) .map(ValueSubkeyRange.fromJson)
.toList(), .toList(),
count: json['count'] as int, count: json['count'] as int,
valueData: ValueData.fromJson(json['value_data'] as Map<String, dynamic>), valueData: ValueData.fromJson(json['value_data']),
$type: json['kind'] as String?, $type: json['kind'] as String?,
); );
@ -262,7 +260,7 @@ Map<String, dynamic> _$$VeilidUpdateValueChangeToJson(
_$_VeilidStateAttachment _$$_VeilidStateAttachmentFromJson( _$_VeilidStateAttachment _$$_VeilidStateAttachmentFromJson(
Map<String, dynamic> json) => Map<String, dynamic> json) =>
_$_VeilidStateAttachment( _$_VeilidStateAttachment(
state: AttachmentState.fromJson(json['state'] as String), state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool, publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool, localNetworkReady: json['local_network_ready'] as bool,
); );
@ -281,9 +279,8 @@ _$_VeilidStateNetwork _$$_VeilidStateNetworkFromJson(
started: json['started'] as bool, started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String), bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String), bpsUp: BigInt.parse(json['bps_up'] as String),
peers: (json['peers'] as List<dynamic>) peers:
.map((e) => PeerTableData.fromJson(e as Map<String, dynamic>)) (json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(),
.toList(),
); );
Map<String, dynamic> _$$_VeilidStateNetworkToJson( Map<String, dynamic> _$$_VeilidStateNetworkToJson(
@ -297,7 +294,7 @@ Map<String, dynamic> _$$_VeilidStateNetworkToJson(
_$_VeilidStateConfig _$$_VeilidStateConfigFromJson(Map<String, dynamic> json) => _$_VeilidStateConfig _$$_VeilidStateConfigFromJson(Map<String, dynamic> json) =>
_$_VeilidStateConfig( _$_VeilidStateConfig(
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>), config: VeilidConfig.fromJson(json['config']),
); );
Map<String, dynamic> _$$_VeilidStateConfigToJson( Map<String, dynamic> _$$_VeilidStateConfigToJson(
@ -308,12 +305,9 @@ Map<String, dynamic> _$$_VeilidStateConfigToJson(
_$_VeilidState _$$_VeilidStateFromJson(Map<String, dynamic> json) => _$_VeilidState _$$_VeilidStateFromJson(Map<String, dynamic> json) =>
_$_VeilidState( _$_VeilidState(
attachment: VeilidStateAttachment.fromJson( attachment: VeilidStateAttachment.fromJson(json['attachment']),
json['attachment'] as Map<String, dynamic>), network: VeilidStateNetwork.fromJson(json['network']),
network: config: VeilidStateConfig.fromJson(json['config']),
VeilidStateNetwork.fromJson(json['network'] as Map<String, dynamic>),
config:
VeilidStateConfig.fromJson(json['config'] as Map<String, dynamic>),
); );
Map<String, dynamic> _$$_VeilidStateToJson(_$_VeilidState instance) => Map<String, dynamic> _$$_VeilidStateToJson(_$_VeilidState instance) =>

View File

@ -6,12 +6,14 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.6'
dependencies: dependencies:
change_case: ^1.0.1 change_case: ^1.0.1
charcode: ^1.3.1 charcode: ^1.3.1
equatable: ^2.0.5 equatable: ^2.0.5
ffi: ^2.0.0 ffi: ^2.0.0
fixnum: ^1.1.0
flutter: flutter:
sdk: flutter sdk: flutter
flutter_web_plugins: flutter_web_plugins:

View File

@ -120,38 +120,38 @@ core:
application: application:
https: https:
enabled: false enabled: false
listen_address: ':5150' listen_address: ':443'
path: 'app' path: 'app'
# url: 'https://localhost:5150' # url: 'https://localhost'
http: http:
enabled: false enabled: false
listen_address: ':5150' listen_address: ':80'
path: 'app' path: 'app'
# url: 'http://localhost:5150' # url: 'http://localhost'
protocol: protocol:
udp: udp:
enabled: true enabled: true
socket_pool_size: 0 socket_pool_size: 0
listen_address: ':5150' listen_address: ''
# public_address: '' # public_address: ''
tcp: tcp:
connect: true connect: true
listen: true listen: true
max_connections: 32 max_connections: 32
listen_address: ':5150' listen_address: ''
#'public_address: '' #'public_address: ''
ws: ws:
connect: true connect: true
listen: true listen: true
max_connections: 16 max_connections: 16
listen_address: ':5150' listen_address: ''
path: 'ws' path: 'ws'
# url: 'ws://localhost:5150/ws' # url: 'ws://localhost:5150/ws'
wss: wss:
connect: true connect: true
listen: false listen: false
max_connections: 16 max_connections: 16
listen_address: ':5150' listen_address: ''
path: 'ws' path: 'ws'
# url: '' # url: ''
"#, "#,
@ -351,6 +351,12 @@ pub struct NamedSocketAddrs {
impl FromStr for NamedSocketAddrs { impl FromStr for NamedSocketAddrs {
type Err = std::io::Error; type Err = std::io::Error;
fn from_str(s: &str) -> Result<NamedSocketAddrs, std::io::Error> { fn from_str(s: &str) -> Result<NamedSocketAddrs, std::io::Error> {
if s.is_empty() {
return Ok(NamedSocketAddrs {
name: String::new(),
addrs: vec![],
});
}
let addr_iter = listen_address_to_socket_addrs(s) let addr_iter = listen_address_to_socket_addrs(s)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e))?; .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e))?;
Ok(NamedSocketAddrs { Ok(NamedSocketAddrs {
@ -1641,13 +1647,10 @@ mod tests {
assert_eq!(s.core.network.tls.connection_initial_timeout_ms, 2_000u32); assert_eq!(s.core.network.tls.connection_initial_timeout_ms, 2_000u32);
// //
assert_eq!(s.core.network.application.https.enabled, false); assert_eq!(s.core.network.application.https.enabled, false);
assert_eq!( assert_eq!(s.core.network.application.https.listen_address.name, ":443");
s.core.network.application.https.listen_address.name,
":5150"
);
assert_eq!( assert_eq!(
s.core.network.application.https.listen_address.addrs, s.core.network.application.https.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap() listen_address_to_socket_addrs(":443").unwrap()
); );
assert_eq!( assert_eq!(
s.core.network.application.https.path, s.core.network.application.https.path,
@ -1655,10 +1658,10 @@ mod tests {
); );
assert_eq!(s.core.network.application.https.url, None); assert_eq!(s.core.network.application.https.url, None);
assert_eq!(s.core.network.application.http.enabled, false); assert_eq!(s.core.network.application.http.enabled, false);
assert_eq!(s.core.network.application.http.listen_address.name, ":5150"); assert_eq!(s.core.network.application.http.listen_address.name, ":80");
assert_eq!( assert_eq!(
s.core.network.application.http.listen_address.addrs, s.core.network.application.http.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap() listen_address_to_socket_addrs(":80").unwrap()
); );
assert_eq!( assert_eq!(
s.core.network.application.http.path, s.core.network.application.http.path,
@ -1668,33 +1671,24 @@ mod tests {
// //
assert_eq!(s.core.network.protocol.udp.enabled, true); assert_eq!(s.core.network.protocol.udp.enabled, true);
assert_eq!(s.core.network.protocol.udp.socket_pool_size, 0); assert_eq!(s.core.network.protocol.udp.socket_pool_size, 0);
assert_eq!(s.core.network.protocol.udp.listen_address.name, ":5150"); assert_eq!(s.core.network.protocol.udp.listen_address.name, "");
assert_eq!( assert_eq!(s.core.network.protocol.udp.listen_address.addrs, vec![]);
s.core.network.protocol.udp.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.udp.public_address, None); assert_eq!(s.core.network.protocol.udp.public_address, None);
// //
assert_eq!(s.core.network.protocol.tcp.connect, true); assert_eq!(s.core.network.protocol.tcp.connect, true);
assert_eq!(s.core.network.protocol.tcp.listen, true); assert_eq!(s.core.network.protocol.tcp.listen, true);
assert_eq!(s.core.network.protocol.tcp.max_connections, 32); assert_eq!(s.core.network.protocol.tcp.max_connections, 32);
assert_eq!(s.core.network.protocol.tcp.listen_address.name, ":5150"); assert_eq!(s.core.network.protocol.tcp.listen_address.name, "");
assert_eq!( assert_eq!(s.core.network.protocol.tcp.listen_address.addrs, vec![]);
s.core.network.protocol.tcp.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.tcp.public_address, None); assert_eq!(s.core.network.protocol.tcp.public_address, None);
// //
assert_eq!(s.core.network.protocol.ws.connect, true); assert_eq!(s.core.network.protocol.ws.connect, true);
assert_eq!(s.core.network.protocol.ws.listen, true); assert_eq!(s.core.network.protocol.ws.listen, true);
assert_eq!(s.core.network.protocol.ws.max_connections, 16); assert_eq!(s.core.network.protocol.ws.max_connections, 16);
assert_eq!(s.core.network.protocol.ws.listen_address.name, ":5150"); assert_eq!(s.core.network.protocol.ws.listen_address.name, "");
assert_eq!( assert_eq!(s.core.network.protocol.ws.listen_address.addrs, vec![]);
s.core.network.protocol.ws.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!( assert_eq!(
s.core.network.protocol.ws.path, s.core.network.protocol.ws.path,
std::path::PathBuf::from("ws") std::path::PathBuf::from("ws")
@ -1704,11 +1698,8 @@ mod tests {
assert_eq!(s.core.network.protocol.wss.connect, true); assert_eq!(s.core.network.protocol.wss.connect, true);
assert_eq!(s.core.network.protocol.wss.listen, false); assert_eq!(s.core.network.protocol.wss.listen, false);
assert_eq!(s.core.network.protocol.wss.max_connections, 16); assert_eq!(s.core.network.protocol.wss.max_connections, 16);
assert_eq!(s.core.network.protocol.wss.listen_address.name, ":5150"); assert_eq!(s.core.network.protocol.wss.listen_address.name, "");
assert_eq!( assert_eq!(s.core.network.protocol.wss.listen_address.addrs, vec![]);
s.core.network.protocol.wss.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!( assert_eq!(
s.core.network.protocol.wss.path, s.core.network.protocol.wss.path,
std::path::PathBuf::from("ws") std::path::PathBuf::from("ws")

View File

@ -1,3 +1,10 @@
/// Eventual is like Dart's "Completer"
/// It is a thread-safe concurrent data future that may eventually resolve to a value
/// Three variants exist
/// Eventual, which will complete each 'instance' future to that instance's value (can be different per instance) only when 'resolve' is called.
/// EventualValue, which will complete each 'instance' future when 'resolve' is called with an owned value, and one of those instances may 'take' the value.
/// EventualValueClone, which will complete each 'instance' future when 'resolve' is called with a Clone-able value, and any of those instances may get a clone of that value.
/// The future returned from an Eventual::resolve() can also be awaited on to wait until all instances have been completed
use super::*; use super::*;
use eventual_base::*; use eventual_base::*;