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) => {
let cnt = o.get_mut();
assert!(*cnt > 0);
if *cnt == 0 {
if *cnt == 1 {
inner.conn_count_by_ip4.remove(&v4);
} else {
*cnt -= 1;
@ -377,7 +377,7 @@ impl AddressFilter {
Entry::Occupied(mut o) => {
let cnt = o.get_mut();
assert!(*cnt > 0);
if *cnt == 0 {
if *cnt == 1 {
inner.conn_count_by_ip6_prefix.remove(&v6);
} else {
*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.
let mut udp_port = 5150u16;
let mut udp_port = start_port;
loop {
if BAD_PORTS.contains(&udp_port) {
continue;
@ -182,9 +182,9 @@ impl Network {
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.
let mut tcp_port = 5150u16;
let mut tcp_port = start_port;
loop {
if BAD_PORTS.contains(&tcp_port) {
continue;
@ -203,7 +203,7 @@ impl Network {
async fn allocate_udp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> {
if listen_address.is_empty() {
// 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![
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
IpAddr::V6(Ipv6Addr::UNSPECIFIED),
@ -218,9 +218,7 @@ impl Network {
bail!("No valid listen address: {}", listen_address);
}
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()))
}
}
@ -228,7 +226,7 @@ impl Network {
async fn allocate_tcp_port(&self, listen_address: String) -> EyreResult<(u16, Vec<IpAddr>)> {
if listen_address.is_empty() {
// 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![
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
IpAddr::V6(Ipv6Addr::UNSPECIFIED),

View File

@ -13,6 +13,9 @@ impl RoutingTable {
"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
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 closest_nodes = self.find_closest_nodes(
let closest_nodes = match self.find_closest_nodes(
node_count,
key,
filters,
@ -54,7 +57,13 @@ impl RoutingTable {
|rti, 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)
}
@ -117,7 +126,7 @@ impl RoutingTable {
};
//
let closest_nodes = self.find_closest_nodes(
let closest_nodes = match self.find_closest_nodes(
node_count,
key,
filters,
@ -127,7 +136,13 @@ impl RoutingTable {
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
// 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,
filters: VecDeque<RoutingTableEntryFilter>,
transform: T,
) -> Vec<O>
) -> VeilidAPIResult<Vec<O>>
where
T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O + Send,
{

View File

@ -1162,7 +1162,7 @@ impl RoutingTableInner {
node_id: TypedKey,
mut filters: VecDeque<RoutingTableEntryFilter>,
transform: T,
) -> Vec<O>
) -> VeilidAPIResult<Vec<O>>
where
T: for<'r> FnMut(&'r RoutingTableInner, Option<Arc<BucketEntry>>) -> O,
{
@ -1170,7 +1170,9 @@ impl RoutingTableInner {
// Get the crypto 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
let filter = Box::new(
@ -1236,7 +1238,7 @@ impl RoutingTableInner {
let out =
self.find_peers_with_sort_and_filter(node_count, cur_ts, filters, sort, transform);
log_rtab!(">> find_closest_nodes: node count = {}", out.len());
out
Ok(out)
}
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
let closest_nodes = {
let routing_table = self.routing_table.clone();
@ -247,11 +247,14 @@ where
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();
ctx.closest_nodes = closest_nodes;
Ok(())
}
pub async fn run(self: Arc<Self>) -> TimeoutOr<Result<Option<R>, RPCError>> {
@ -264,7 +267,9 @@ where
};
// 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
if self.clone().evaluate_done() {
@ -283,7 +288,11 @@ where
}
// Wait for them to complete
timeout(timeout_ms, async {
while let Some(_) = unord.next().await {}
while let Some(_) = unord.next().await {
if self.clone().evaluate_done() {
break;
}
}
})
.await
.into_timeout_or()

View File

@ -13,7 +13,6 @@ struct OutboundGetValueContext {
}
impl StorageManager {
/// Perform a 'get value' query on the network
pub async fn outbound_get_value(
&self,
@ -74,15 +73,14 @@ impl StorageManager {
if let Some(descriptor) = gva.answer.descriptor {
let mut ctx = context.lock();
if ctx.descriptor.is_none() && ctx.schema.is_none() {
ctx.schema =
Some(descriptor.schema().map_err(RPCError::invalid_format)?);
ctx.schema = Some(descriptor.schema().map_err(RPCError::invalid_format)?);
ctx.descriptor = Some(descriptor);
}
}
// Keep the value if we got one and it is newer and it passes schema validation
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();
// Ensure we have a schema and descriptor
@ -126,8 +124,7 @@ impl StorageManager {
} else {
// If the sequence number is older, ignore it
}
}
else {
} else {
// If we have no prior value, keep it
ctx.value = Some(value);
// One node has shown us this value so far
@ -136,7 +133,7 @@ impl StorageManager {
}
// 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());
Ok(Some(gva.answer.peers))
@ -147,7 +144,8 @@ impl StorageManager {
let check_done = |_closest_nodes: &[NodeRef]| {
// If we have reached sufficient consensus, return done
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(());
}
None
@ -167,14 +165,31 @@ impl StorageManager {
match fanout_call.run().await {
// 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)
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)
TimeoutOr::Value(Ok(None)) => {
// Return the best answer we've got
let ctx = context.lock();
Ok(SubkeyResult{
log_stor!(debug "GetValue Fanout No Consensus: {}", ctx.value_count);
Ok(SubkeyResult {
value: ctx.value.clone(),
descriptor: ctx.descriptor.clone(),
})
@ -182,22 +197,31 @@ impl StorageManager {
// Failed
TimeoutOr::Value(Err(e)) => {
// If we finished with an error, return that
log_stor!(debug "GetValue Fanout Error: {}", e);
Err(e.into())
}
}
}
/// 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 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,
Err(VeilidAPIError::Internal { message }) => {
apibail_internal!(message);
},
}
Err(e) => {
return Ok(NetworkResult::invalid_message(e));
},
}
};
Ok(NetworkResult::value(res))
}

View File

@ -18,6 +18,7 @@ use storage_manager_inner::*;
pub use types::*;
use super::*;
use network_manager::*;
use routing_table::*;
use rpc_processor::*;
@ -27,6 +28,8 @@ const MAX_SUBKEY_SIZE: usize = ValueData::MAX_LEN;
const MAX_RECORD_DATA_SIZE: usize = 1_048_576;
/// Frequency to flush record stores to disk
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 {
config: VeilidConfig,
@ -37,6 +40,7 @@ struct StorageManagerUnlockedInner {
// Background processes
flush_record_stores_task: TickTask<EyreReport>,
offline_subkey_writes_task: TickTask<EyreReport>,
}
#[derive(Clone)]
@ -59,6 +63,7 @@ impl StorageManager {
#[cfg(feature = "unstable-blockstore")]
block_store,
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 {
@ -127,6 +132,40 @@ impl StorageManager {
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
pub async fn create_record(
&self,
@ -201,6 +240,17 @@ impl StorageManager {
// Reopen inner to store value we just got
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
inner
.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
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
inner
.handle_set_local_value(key, subkey, signed_value_data.clone())
.await?;
log_stor!(debug "Writing subkey offline: {}:{} len={}", key, subkey, signed_value_data.value_data().data().len() );
// 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)
};

View File

@ -11,7 +11,6 @@ struct OutboundSetValueContext {
}
impl StorageManager {
/// Perform a 'set value' query on the network
pub async fn outbound_set_value(
&self,
@ -49,7 +48,6 @@ impl StorageManager {
let context = context.clone();
let descriptor = descriptor.clone();
async move {
let send_descriptor = true; // xxx check if next_node needs the descriptor or not
// 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
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
if !ctx.schema.check_subkey_value_data(
@ -101,14 +100,12 @@ impl StorageManager {
// One node has shown us this value so far
ctx.value_count = 1;
} 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.
// Skip this node and it's closer list because it is misbehaving
return Ok(None);
}
}
else
{
} else {
// It was set on this node and no newer value was found and returned,
// so increase our consensus count
ctx.value_count += 1;
@ -116,7 +113,7 @@ impl StorageManager {
}
// 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());
Ok(Some(sva.answer.peers))
@ -147,18 +144,30 @@ impl StorageManager {
match fanout_call.run().await {
// 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)
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)
TimeoutOr::Value(Ok(None)) => {
// Return the best answer we've got
let ctx = context.lock();
log_stor!(debug "SetValue Fanout No Consensus: {}", ctx.value_count);
Ok(ctx.value.clone())
}
// Failed
TimeoutOr::Value(Err(e)) => {
// If we finished with an error, return that
log_stor!(debug "SetValue Fanout Error: {}", e);
Err(e.into())
}
}
@ -167,7 +176,13 @@ impl StorageManager {
/// Handle a recieved 'Set Value' query
/// 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
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?;
// See if this is a remote or local value
@ -198,19 +213,23 @@ impl StorageManager {
if let Some(descriptor) = descriptor {
// Descriptor must match last one if it is provided
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 {
// Descriptor was not provided always go with last descriptor
}
last_descriptor
}
}
None => {
if let Some(descriptor) = descriptor {
descriptor
} else {
// 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 {
inner.handle_set_local_value(key, subkey, value).await
} 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 {
Ok(()) => {},
match res {
Ok(()) => {}
Err(VeilidAPIError::Internal { message }) => {
apibail_internal!(message);
},
}
Err(e) => {
return Ok(NetworkResult::invalid_message(e));
},
}
}
Ok(NetworkResult::value(None))
}

View File

@ -3,6 +3,12 @@ use super::*;
const STORAGE_MANAGER_METADATA: &str = "storage_manager_metadata";
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
pub(super) struct StorageManagerInner {
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
pub remote_record_store: Option<RecordStore<RemoteRecordDetail>>,
/// 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
pub metadata_db: Option<TableDB>,
/// RPC processor if it is available

View File

@ -1,10 +1,11 @@
pub mod flush_record_stores;
pub mod offline_subkey_writes;
use super::*;
impl StorageManager {
pub(crate) fn setup_tasks(&self) {
// Set rolling transfers tick task
// Set flush records tick task
debug!("starting flush record stores task");
{
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<()> {
// Run the rolling transfers task
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(())
}
@ -39,5 +68,9 @@ impl StorageManager {
if let Err(e) = self.unlocked_inner.flush_record_stores_task.stop().await {
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,
sequencing: Sequencing,
) -> VeilidAPIResult<(RouteId, Vec<u8>)> {
for kind in crypto_kinds {
Crypto::validate_crypto_kind(*kind)?;
}
let default_route_hop_count: usize = {
let config = self.config()?;
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> {
Ok(r#"buckets [dead|reliable]
dialinfo
@ -1358,6 +1380,7 @@ restart network
contact <node>[<modifiers>]
ping <destination>
relay <relay> [public|local]
punish list
route allocate [ord|*ord] [rel] [<count>] [in|out]
release <route>
publish <route> [full]
@ -1450,6 +1473,8 @@ record list <local|remote>
self.debug_route(rest).await
} else if arg == "record" {
self.debug_record(rest).await
} else if arg == "punish" {
self.debug_punish(rest).await
} else {
Err(VeilidAPIError::generic("Unknown server debug command"))
}

View File

@ -199,6 +199,7 @@ impl RoutingContext {
kind: Option<CryptoKind>,
) -> VeilidAPIResult<DHTRecordDescriptor> {
let kind = kind.unwrap_or(best_crypto_kind());
Crypto::validate_crypto_kind(kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager
.create_record(kind, schema, self.unlocked_inner.safety_selection)
@ -213,6 +214,7 @@ impl RoutingContext {
key: TypedKey,
writer: Option<KeyPair>,
) -> VeilidAPIResult<DHTRecordDescriptor> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager
.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.
/// Closing a record allows you to re-open it with a different routing context
pub async fn close_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
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
/// 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<()> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager.delete_record(key).await
}
@ -244,6 +248,7 @@ impl RoutingContext {
subkey: ValueSubkey,
force_refresh: bool,
) -> VeilidAPIResult<Option<ValueData>> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager.get_value(key, subkey, force_refresh).await
}
@ -257,6 +262,7 @@ impl RoutingContext {
subkey: ValueSubkey,
data: Vec<u8>,
) -> VeilidAPIResult<Option<ValueData>> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager.set_value(key, subkey, data).await
}
@ -273,6 +279,7 @@ impl RoutingContext {
expiration: Timestamp,
count: u32,
) -> VeilidAPIResult<Timestamp> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager
.watch_values(key, subkeys, expiration, count)
@ -286,6 +293,7 @@ impl RoutingContext {
key: TypedKey,
subkeys: ValueSubkeyRangeSet,
) -> VeilidAPIResult<bool> {
Crypto::validate_crypto_kind(key.kind)?;
let storage_manager = self.api.storage_manager()?;
storage_manager.cancel_watch_values(key, subkeys).await
}

View File

@ -113,6 +113,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.1"
fixnum:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@ -403,7 +411,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.6"
version: "0.1.7"
win32:
dependency: transitive
description:
@ -430,4 +438,4 @@ packages:
version: "3.5.0"
sdks:
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(
resolveNodeTimeoutMs: 10000,
resolveNodeCount: 20,
resolveNodeFanout: 3,
resolveNodeCount: 1,
resolveNodeFanout: 4,
maxFindNodeCount: 20,
getValueTimeoutMs: 10000,
getValueCount: 20,
getValueFanout: 3,
getValueCount: 3,
getValueFanout: 4,
setValueTimeoutMs: 10000,
setValueCount: 20,
setValueFanout: 5,
setValueCount: 4,
setValueFanout: 6,
minPeerCount: 20,
minPeerRefreshTimeMs: 60000,
validateDialInfoReceiptTimeMs: 2000,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,8 +39,8 @@ Map<String, dynamic> _$$_TransferStatsToJson(_$_TransferStats instance) =>
_$_TransferStatsDownUp _$$_TransferStatsDownUpFromJson(
Map<String, dynamic> json) =>
_$_TransferStatsDownUp(
down: TransferStats.fromJson(json['down'] as Map<String, dynamic>),
up: TransferStats.fromJson(json['up'] as Map<String, dynamic>),
down: TransferStats.fromJson(json['down']),
up: TransferStats.fromJson(json['up']),
);
Map<String, dynamic> _$$_TransferStatsDownUpToJson(
@ -81,20 +81,19 @@ Map<String, dynamic> _$$_RPCStatsToJson(_$_RPCStats instance) =>
_$_PeerStats _$$_PeerStatsFromJson(Map<String, dynamic> json) => _$_PeerStats(
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
? null
: LatencyStats.fromJson(json['latency'] as Map<String, dynamic>),
transfer: TransferStatsDownUp.fromJson(
json['transfer'] as Map<String, dynamic>),
: LatencyStats.fromJson(json['latency']),
);
Map<String, dynamic> _$$_PeerStatsToJson(_$_PeerStats instance) =>
<String, dynamic>{
'time_added': instance.timeAdded.toJson(),
'rpc_stats': instance.rpcStats.toJson(),
'latency': instance.latency?.toJson(),
'transfer': instance.transfer.toJson(),
'latency': instance.latency?.toJson(),
};
_$_PeerTableData _$$_PeerTableDataFromJson(Map<String, dynamic> json) =>
@ -103,7 +102,7 @@ _$_PeerTableData _$$_PeerTableDataFromJson(Map<String, dynamic> json) =>
.map(Typed<FixedEncodedString43>.fromJson)
.toList(),
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) =>
@ -114,7 +113,7 @@ Map<String, dynamic> _$$_PeerTableDataToJson(_$_PeerTableData instance) =>
};
_$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,
backtrace: json['backtrace'] as String?,
$type: json['kind'] as String?,
@ -130,44 +129,44 @@ Map<String, dynamic> _$$VeilidLogToJson(_$VeilidLog instance) =>
_$VeilidAppMessage _$$VeilidAppMessageFromJson(Map<String, dynamic> json) =>
_$VeilidAppMessage(
message:
const Uint8ListJsonConverter().fromJson(json['message'] as String),
sender: json['sender'] == null
? null
: Typed<FixedEncodedString43>.fromJson(json['sender']),
message:
const Uint8ListJsonConverter().fromJson(json['message'] as String),
$type: json['kind'] as String?,
);
Map<String, dynamic> _$$VeilidAppMessageToJson(_$VeilidAppMessage instance) =>
<String, dynamic>{
'sender': instance.sender?.toJson(),
'message': const Uint8ListJsonConverter().toJson(instance.message),
'sender': instance.sender?.toJson(),
'kind': instance.$type,
};
_$VeilidAppCall _$$VeilidAppCallFromJson(Map<String, dynamic> json) =>
_$VeilidAppCall(
sender: json['sender'] == null
? null
: Typed<FixedEncodedString43>.fromJson(json['sender']),
message:
const Uint8ListJsonConverter().fromJson(json['message'] as String),
callId: json['call_id'] as String,
sender: json['sender'] == null
? null
: Typed<FixedEncodedString43>.fromJson(json['sender']),
$type: json['kind'] as String?,
);
Map<String, dynamic> _$$VeilidAppCallToJson(_$VeilidAppCall instance) =>
<String, dynamic>{
'sender': instance.sender?.toJson(),
'message': const Uint8ListJsonConverter().toJson(instance.message),
'call_id': instance.callId,
'sender': instance.sender?.toJson(),
'kind': instance.$type,
};
_$VeilidUpdateAttachment _$$VeilidUpdateAttachmentFromJson(
Map<String, dynamic> json) =>
_$VeilidUpdateAttachment(
state: AttachmentState.fromJson(json['state'] as String),
state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool,
$type: json['kind'] as String?,
@ -188,9 +187,8 @@ _$VeilidUpdateNetwork _$$VeilidUpdateNetworkFromJson(
started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String),
peers: (json['peers'] as List<dynamic>)
.map((e) => PeerTableData.fromJson(e as Map<String, dynamic>))
.toList(),
peers:
(json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(),
$type: json['kind'] as String?,
);
@ -206,7 +204,7 @@ Map<String, dynamic> _$$VeilidUpdateNetworkToJson(
_$VeilidUpdateConfig _$$VeilidUpdateConfigFromJson(Map<String, dynamic> json) =>
_$VeilidUpdateConfig(
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>),
config: VeilidConfig.fromJson(json['config']),
$type: json['kind'] as String?,
);
@ -242,10 +240,10 @@ _$VeilidUpdateValueChange _$$VeilidUpdateValueChangeFromJson(
_$VeilidUpdateValueChange(
key: Typed<FixedEncodedString43>.fromJson(json['key']),
subkeys: (json['subkeys'] as List<dynamic>)
.map((e) => ValueSubkeyRange.fromJson(e as Map<String, dynamic>))
.map(ValueSubkeyRange.fromJson)
.toList(),
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?,
);
@ -262,7 +260,7 @@ Map<String, dynamic> _$$VeilidUpdateValueChangeToJson(
_$_VeilidStateAttachment _$$_VeilidStateAttachmentFromJson(
Map<String, dynamic> json) =>
_$_VeilidStateAttachment(
state: AttachmentState.fromJson(json['state'] as String),
state: AttachmentState.fromJson(json['state']),
publicInternetReady: json['public_internet_ready'] as bool,
localNetworkReady: json['local_network_ready'] as bool,
);
@ -281,9 +279,8 @@ _$_VeilidStateNetwork _$$_VeilidStateNetworkFromJson(
started: json['started'] as bool,
bpsDown: BigInt.parse(json['bps_down'] as String),
bpsUp: BigInt.parse(json['bps_up'] as String),
peers: (json['peers'] as List<dynamic>)
.map((e) => PeerTableData.fromJson(e as Map<String, dynamic>))
.toList(),
peers:
(json['peers'] as List<dynamic>).map(PeerTableData.fromJson).toList(),
);
Map<String, dynamic> _$$_VeilidStateNetworkToJson(
@ -297,7 +294,7 @@ Map<String, dynamic> _$$_VeilidStateNetworkToJson(
_$_VeilidStateConfig _$$_VeilidStateConfigFromJson(Map<String, dynamic> json) =>
_$_VeilidStateConfig(
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>),
config: VeilidConfig.fromJson(json['config']),
);
Map<String, dynamic> _$$_VeilidStateConfigToJson(
@ -308,12 +305,9 @@ Map<String, dynamic> _$$_VeilidStateConfigToJson(
_$_VeilidState _$$_VeilidStateFromJson(Map<String, dynamic> json) =>
_$_VeilidState(
attachment: VeilidStateAttachment.fromJson(
json['attachment'] as Map<String, dynamic>),
network:
VeilidStateNetwork.fromJson(json['network'] as Map<String, dynamic>),
config:
VeilidStateConfig.fromJson(json['config'] as Map<String, dynamic>),
attachment: VeilidStateAttachment.fromJson(json['attachment']),
network: VeilidStateNetwork.fromJson(json['network']),
config: VeilidStateConfig.fromJson(json['config']),
);
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:
sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.6'
dependencies:
change_case: ^1.0.1
charcode: ^1.3.1
equatable: ^2.0.5
ffi: ^2.0.0
fixnum: ^1.1.0
flutter:
sdk: flutter
flutter_web_plugins:

View File

@ -120,38 +120,38 @@ core:
application:
https:
enabled: false
listen_address: ':5150'
listen_address: ':443'
path: 'app'
# url: 'https://localhost:5150'
# url: 'https://localhost'
http:
enabled: false
listen_address: ':5150'
listen_address: ':80'
path: 'app'
# url: 'http://localhost:5150'
# url: 'http://localhost'
protocol:
udp:
enabled: true
socket_pool_size: 0
listen_address: ':5150'
listen_address: ''
# public_address: ''
tcp:
connect: true
listen: true
max_connections: 32
listen_address: ':5150'
listen_address: ''
#'public_address: ''
ws:
connect: true
listen: true
max_connections: 16
listen_address: ':5150'
listen_address: ''
path: 'ws'
# url: 'ws://localhost:5150/ws'
wss:
connect: true
listen: false
max_connections: 16
listen_address: ':5150'
listen_address: ''
path: 'ws'
# url: ''
"#,
@ -351,6 +351,12 @@ pub struct NamedSocketAddrs {
impl FromStr for NamedSocketAddrs {
type Err = 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)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidInput, e))?;
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.application.https.enabled, false);
assert_eq!(
s.core.network.application.https.listen_address.name,
":5150"
);
assert_eq!(s.core.network.application.https.listen_address.name, ":443");
assert_eq!(
s.core.network.application.https.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
listen_address_to_socket_addrs(":443").unwrap()
);
assert_eq!(
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.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!(
s.core.network.application.http.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
listen_address_to_socket_addrs(":80").unwrap()
);
assert_eq!(
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.socket_pool_size, 0);
assert_eq!(s.core.network.protocol.udp.listen_address.name, ":5150");
assert_eq!(
s.core.network.protocol.udp.listen_address.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.udp.listen_address.name, "");
assert_eq!(s.core.network.protocol.udp.listen_address.addrs, vec![]);
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.listen, true);
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.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.tcp.listen_address.name, "");
assert_eq!(s.core.network.protocol.tcp.listen_address.addrs, vec![]);
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.listen, true);
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.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.ws.listen_address.name, "");
assert_eq!(s.core.network.protocol.ws.listen_address.addrs, vec![]);
assert_eq!(
s.core.network.protocol.ws.path,
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.listen, false);
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.addrs,
listen_address_to_socket_addrs(":5150").unwrap()
);
assert_eq!(s.core.network.protocol.wss.listen_address.name, "");
assert_eq!(s.core.network.protocol.wss.listen_address.addrs, vec![]);
assert_eq!(
s.core.network.protocol.wss.path,
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 eventual_base::*;