checkpoint
This commit is contained in:
@@ -92,6 +92,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.4"
|
||||
file_utils:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_utils
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -121,6 +128,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
globbing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: globbing
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -287,6 +301,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
system_info2:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: system_info2
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@@ -1,8 +1,53 @@
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:system_info2/system_info2.dart' as sysinfo;
|
||||
import 'veilid.dart';
|
||||
|
||||
const int megaByte = 1024 * 1024;
|
||||
|
||||
int getLocalSubkeyCacheSize() {
|
||||
if (kIsWeb) {
|
||||
return 128;
|
||||
}
|
||||
return 1024;
|
||||
}
|
||||
|
||||
int getLocalMaxSubkeyCacheMemoryMb() {
|
||||
if (kIsWeb) {
|
||||
return 256;
|
||||
}
|
||||
return sysinfo.SysInfo.getTotalPhysicalMemory() ~/ 32 ~/ megaByte;
|
||||
}
|
||||
|
||||
int getRemoteSubkeyCacheSize() {
|
||||
if (kIsWeb) {
|
||||
return 64;
|
||||
}
|
||||
return 128;
|
||||
}
|
||||
|
||||
int getRemoteMaxRecords() {
|
||||
if (kIsWeb) {
|
||||
return 64;
|
||||
}
|
||||
return 128;
|
||||
}
|
||||
|
||||
int getRemoteMaxSubkeyCacheMemoryMb() {
|
||||
if (kIsWeb) {
|
||||
return 256;
|
||||
}
|
||||
return sysinfo.SysInfo.getTotalPhysicalMemory() ~/ 32 ~/ megaByte;
|
||||
}
|
||||
|
||||
int getRemoteMaxStorageSpaceMb() {
|
||||
if (kIsWeb) {
|
||||
return 128;
|
||||
}
|
||||
return 256;
|
||||
}
|
||||
|
||||
Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
return VeilidConfig(
|
||||
programName: programName,
|
||||
@@ -63,25 +108,30 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
queueSize: 1024,
|
||||
maxTimestampBehindMs: 10000,
|
||||
maxTimestampAheadMs: 10000,
|
||||
timeoutMs: 10000,
|
||||
timeoutMs: 5000,
|
||||
maxRouteHopCount: 4,
|
||||
defaultRouteHopCount: 1,
|
||||
),
|
||||
dht: VeilidConfigDHT(
|
||||
resolveNodeTimeoutMs: null,
|
||||
resolveNodeCount: 20,
|
||||
resolveNodeFanout: 3,
|
||||
maxFindNodeCount: 20,
|
||||
getValueTimeoutMs: null,
|
||||
getValueCount: 20,
|
||||
getValueFanout: 3,
|
||||
setValueTimeoutMs: null,
|
||||
setValueCount: 20,
|
||||
setValueFanout: 5,
|
||||
minPeerCount: 20,
|
||||
minPeerRefreshTimeMs: 2000,
|
||||
validateDialInfoReceiptTimeMs: 2000,
|
||||
),
|
||||
resolveNodeTimeoutMs: 10000,
|
||||
resolveNodeCount: 20,
|
||||
resolveNodeFanout: 3,
|
||||
maxFindNodeCount: 20,
|
||||
getValueTimeoutMs: 10000,
|
||||
getValueCount: 20,
|
||||
getValueFanout: 3,
|
||||
setValueTimeoutMs: 10000,
|
||||
setValueCount: 20,
|
||||
setValueFanout: 5,
|
||||
minPeerCount: 20,
|
||||
minPeerRefreshTimeMs: 2000,
|
||||
validateDialInfoReceiptTimeMs: 2000,
|
||||
localSubkeyCacheSize: getLocalSubkeyCacheSize(),
|
||||
localMaxSubkeyCacheMemoryMb: getLocalMaxSubkeyCacheMemoryMb(),
|
||||
remoteSubkeyCacheSize: getRemoteSubkeyCacheSize(),
|
||||
remoteMaxRecords: getRemoteMaxRecords(),
|
||||
remoteMaxSubkeyCacheMemoryMb: getRemoteMaxSubkeyCacheMemoryMb(),
|
||||
remoteMaxStorageSpaceMb: getRemoteMaxStorageSpaceMb()),
|
||||
upnp: true,
|
||||
detectAddressChanges: true,
|
||||
restrictedNatRetries: 0,
|
||||
|
@@ -588,34 +588,46 @@ class VeilidConfigTLS {
|
||||
////////////
|
||||
|
||||
class VeilidConfigDHT {
|
||||
int? resolveNodeTimeoutMs;
|
||||
int resolveNodeTimeoutMs;
|
||||
int resolveNodeCount;
|
||||
int resolveNodeFanout;
|
||||
int maxFindNodeCount;
|
||||
int? getValueTimeoutMs;
|
||||
int getValueTimeoutMs;
|
||||
int getValueCount;
|
||||
int getValueFanout;
|
||||
int? setValueTimeoutMs;
|
||||
int setValueTimeoutMs;
|
||||
int setValueCount;
|
||||
int setValueFanout;
|
||||
int minPeerCount;
|
||||
int minPeerRefreshTimeMs;
|
||||
int validateDialInfoReceiptTimeMs;
|
||||
int localSubkeyCacheSize;
|
||||
int localMaxSubkeyCacheMemoryMb;
|
||||
int remoteSubkeyCacheSize;
|
||||
int remoteMaxRecords;
|
||||
int remoteMaxSubkeyCacheMemoryMb;
|
||||
int remoteMaxStorageSpaceMb;
|
||||
|
||||
VeilidConfigDHT(
|
||||
{this.resolveNodeTimeoutMs,
|
||||
{required this.resolveNodeTimeoutMs,
|
||||
required this.resolveNodeCount,
|
||||
required this.resolveNodeFanout,
|
||||
required this.maxFindNodeCount,
|
||||
this.getValueTimeoutMs,
|
||||
required this.getValueTimeoutMs,
|
||||
required this.getValueCount,
|
||||
required this.getValueFanout,
|
||||
this.setValueTimeoutMs,
|
||||
required this.setValueTimeoutMs,
|
||||
required this.setValueCount,
|
||||
required this.setValueFanout,
|
||||
required this.minPeerCount,
|
||||
required this.minPeerRefreshTimeMs,
|
||||
required this.validateDialInfoReceiptTimeMs});
|
||||
required this.validateDialInfoReceiptTimeMs,
|
||||
required this.localSubkeyCacheSize,
|
||||
required this.localMaxSubkeyCacheMemoryMb,
|
||||
required this.remoteSubkeyCacheSize,
|
||||
required this.remoteMaxRecords,
|
||||
required this.remoteMaxSubkeyCacheMemoryMb,
|
||||
required this.remoteMaxStorageSpaceMb});
|
||||
|
||||
Map<String, dynamic> get json {
|
||||
return {
|
||||
@@ -631,7 +643,13 @@ class VeilidConfigDHT {
|
||||
'set_value_fanout': setValueFanout,
|
||||
'min_peer_count': minPeerCount,
|
||||
'min_peer_refresh_time_ms': minPeerRefreshTimeMs,
|
||||
'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs
|
||||
'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs,
|
||||
'local_subkey_cache_size: 128': localSubkeyCacheSize,
|
||||
'local_max_subkey_cache_memory_mb': localMaxSubkeyCacheMemoryMb,
|
||||
'remote_subkey_cache_size': remoteSubkeyCacheSize,
|
||||
'remote_max_records': remoteMaxRecords,
|
||||
'remote_max_subkey_cache_memory_mb': remoteMaxSubkeyCacheMemoryMb,
|
||||
'remote_max_storage_space_mb': remoteMaxStorageSpaceMb,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -649,7 +667,14 @@ class VeilidConfigDHT {
|
||||
minPeerCount = json['min_peer_count'],
|
||||
minPeerRefreshTimeMs = json['min_peer_refresh_time_ms'],
|
||||
validateDialInfoReceiptTimeMs =
|
||||
json['validate_dial_info_receipt_time_ms'];
|
||||
json['validate_dial_info_receipt_time_ms'],
|
||||
localSubkeyCacheSize = json['local_subkey_cache_size'],
|
||||
localMaxSubkeyCacheMemoryMb = json['local_max_subkey_cache_memory_mb'],
|
||||
remoteSubkeyCacheSize = json['remote_subkey_cache_size'],
|
||||
remoteMaxRecords = json['remote_max_records'],
|
||||
remoteMaxSubkeyCacheMemoryMb =
|
||||
json['remote_max_subkey_cache_memory_mb'],
|
||||
remoteMaxStorageSpaceMb = json['remote_max_storage_space_mb'];
|
||||
}
|
||||
|
||||
////////////
|
||||
|
@@ -17,6 +17,7 @@ dependencies:
|
||||
change_case: ^1.0.1
|
||||
path_provider: ^2.0.9
|
||||
path: ^1.8.0
|
||||
system_info2: ^3.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user