fix macos
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:change_case/change_case.dart';
|
||||
|
||||
@@ -201,17 +200,15 @@ class ValueData {
|
||||
|
||||
enum Stability {
|
||||
lowLatency,
|
||||
reliable,
|
||||
}
|
||||
reliable;
|
||||
|
||||
extension StabilityExt on Stability {
|
||||
String toJson() {
|
||||
return name.toPascalCase();
|
||||
}
|
||||
}
|
||||
|
||||
Stability stabilityFromJson(String j) {
|
||||
return Stability.values.byName(j.toCamelCase());
|
||||
factory Stability.fromJson(String j) {
|
||||
return Stability.values.byName(j.toCamelCase());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -220,17 +217,15 @@ Stability stabilityFromJson(String j) {
|
||||
enum Sequencing {
|
||||
noPreference,
|
||||
preferOrdered,
|
||||
ensureOrdered,
|
||||
}
|
||||
ensureOrdered;
|
||||
|
||||
extension SequencingExt on Sequencing {
|
||||
String toJson() {
|
||||
return name.toPascalCase();
|
||||
}
|
||||
}
|
||||
|
||||
Sequencing sequencingFromJson(String j) {
|
||||
return Sequencing.values.byName(j.toCamelCase());
|
||||
factory Sequencing.fromJson(String j) {
|
||||
return Sequencing.values.byName(j.toCamelCase());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
@@ -1,22 +1,16 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:change_case/change_case.dart';
|
||||
|
||||
import 'veilid_stub.dart'
|
||||
if (dart.library.io) 'veilid_ffi.dart'
|
||||
if (dart.library.js) 'veilid_js.dart';
|
||||
|
||||
import 'veilid_encoding.dart';
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
import 'routing_context.dart';
|
||||
import 'veilid_config.dart';
|
||||
import 'veilid_crypto.dart';
|
||||
import 'veilid_table_db.dart';
|
||||
import 'veilid_api_exception.dart';
|
||||
import 'veilid_state.dart';
|
||||
|
||||
export 'default_config.dart';
|
||||
@@ -126,7 +120,7 @@ class TimestampDuration {
|
||||
/// Veilid singleton factory
|
||||
|
||||
abstract class Veilid {
|
||||
static late Veilid instance = getVeilid();
|
||||
static Veilid instance = getVeilid();
|
||||
|
||||
void initializeVeilidCore(Map<String, dynamic> platformConfigJson);
|
||||
void changeLogLevel(String layer, VeilidConfigLogLevel logLevel);
|
||||
|
@@ -1,10 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:change_case/change_case.dart';
|
||||
|
||||
import 'veilid_encoding.dart';
|
||||
import 'veilid.dart';
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -28,7 +23,7 @@ class VeilidFFIConfigLoggingTerminal {
|
||||
|
||||
VeilidFFIConfigLoggingTerminal.fromJson(dynamic json)
|
||||
: enabled = json['enabled'],
|
||||
level = veilidConfigLogLevelFromJson(json['level']);
|
||||
level = VeilidConfigLogLevel.fromJson(json['level']);
|
||||
}
|
||||
|
||||
class VeilidFFIConfigLoggingOtlp {
|
||||
@@ -55,7 +50,7 @@ class VeilidFFIConfigLoggingOtlp {
|
||||
|
||||
VeilidFFIConfigLoggingOtlp.fromJson(dynamic json)
|
||||
: enabled = json['enabled'],
|
||||
level = veilidConfigLogLevelFromJson(json['level']),
|
||||
level = VeilidConfigLogLevel.fromJson(json['level']),
|
||||
grpcEndpoint = json['grpc_endpoint'],
|
||||
serviceName = json['service_name'];
|
||||
}
|
||||
@@ -78,7 +73,7 @@ class VeilidFFIConfigLoggingApi {
|
||||
|
||||
VeilidFFIConfigLoggingApi.fromJson(dynamic json)
|
||||
: enabled = json['enabled'],
|
||||
level = veilidConfigLogLevelFromJson(json['level']);
|
||||
level = VeilidConfigLogLevel.fromJson(json['level']);
|
||||
}
|
||||
|
||||
class VeilidFFIConfigLogging {
|
||||
@@ -129,17 +124,15 @@ enum VeilidConfigLogLevel {
|
||||
warn,
|
||||
info,
|
||||
debug,
|
||||
trace,
|
||||
}
|
||||
trace;
|
||||
|
||||
extension VeilidConfigLogLevelExt on VeilidConfigLogLevel {
|
||||
String toJson() {
|
||||
return name.toPascalCase();
|
||||
}
|
||||
}
|
||||
|
||||
VeilidConfigLogLevel veilidConfigLogLevelFromJson(String j) {
|
||||
return VeilidConfigLogLevel.values.byName(j.toCamelCase());
|
||||
factory VeilidConfigLogLevel.fromJson(dynamic j) {
|
||||
return VeilidConfigLogLevel.values.byName((j as String).toCamelCase());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -169,7 +162,7 @@ class VeilidWASMConfigLoggingPerformance {
|
||||
|
||||
VeilidWASMConfigLoggingPerformance.fromJson(dynamic json)
|
||||
: enabled = json['enabled'],
|
||||
level = veilidConfigLogLevelFromJson(json['level']),
|
||||
level = VeilidConfigLogLevel.fromJson(json['level']),
|
||||
logsInTimings = json['logs_in_timings'],
|
||||
logsInConsole = json['logs_in_console'];
|
||||
}
|
||||
@@ -192,7 +185,7 @@ class VeilidWASMConfigLoggingApi {
|
||||
|
||||
VeilidWASMConfigLoggingApi.fromJson(dynamic json)
|
||||
: enabled = json['enabled'],
|
||||
level = veilidConfigLogLevelFromJson(json['level']);
|
||||
level = VeilidConfigLogLevel.fromJson(json['level']);
|
||||
}
|
||||
|
||||
class VeilidWASMConfigLogging {
|
||||
@@ -574,7 +567,7 @@ class VeilidConfigDHT {
|
||||
'min_peer_count': minPeerCount,
|
||||
'min_peer_refresh_time_ms': minPeerRefreshTimeMs,
|
||||
'validate_dial_info_receipt_time_ms': validateDialInfoReceiptTimeMs,
|
||||
'local_subkey_cache_size: 128': localSubkeyCacheSize,
|
||||
'local_subkey_cache_size': localSubkeyCacheSize,
|
||||
'local_max_subkey_cache_memory_mb': localMaxSubkeyCacheMemoryMb,
|
||||
'remote_subkey_cache_size': remoteSubkeyCacheSize,
|
||||
'remote_max_records': remoteMaxRecords,
|
||||
|
@@ -305,7 +305,7 @@ typedef _VeilidVersionStringC = Pointer<Utf8> Function();
|
||||
typedef _VeilidVersionStringDart = Pointer<Utf8> Function();
|
||||
|
||||
// fn veilid_version() -> VeilidVersion
|
||||
class VeilidVersionFFI extends Struct {
|
||||
final class VeilidVersionFFI extends Struct {
|
||||
@Uint32()
|
||||
external int major;
|
||||
@Uint32()
|
||||
@@ -582,7 +582,7 @@ class _Ctx {
|
||||
class VeilidRoutingContextFFI implements VeilidRoutingContext {
|
||||
final _Ctx _ctx;
|
||||
static final Finalizer<_Ctx> _finalizer =
|
||||
Finalizer((ctx) => {ctx.ffi._releaseRoutingContext(ctx.id)});
|
||||
Finalizer((ctx) => ctx.ffi._releaseRoutingContext(ctx.id));
|
||||
|
||||
VeilidRoutingContextFFI._(this._ctx) {
|
||||
_finalizer.attach(this, _ctx, detach: this);
|
||||
@@ -751,7 +751,7 @@ class _TDBT {
|
||||
class VeilidTableDBTransactionFFI extends VeilidTableDBTransaction {
|
||||
final _TDBT _tdbt;
|
||||
static final Finalizer<_TDBT> _finalizer =
|
||||
Finalizer((tdbt) => {tdbt.ffi._releaseTableDbTransaction(tdbt.id)});
|
||||
Finalizer((tdbt) => tdbt.ffi._releaseTableDbTransaction(tdbt.id));
|
||||
|
||||
VeilidTableDBTransactionFFI._(this._tdbt) {
|
||||
_finalizer.attach(this, _tdbt, detach: this);
|
||||
@@ -822,7 +822,7 @@ class _TDB {
|
||||
class VeilidTableDBFFI extends VeilidTableDB {
|
||||
final _TDB _tdb;
|
||||
static final Finalizer<_TDB> _finalizer =
|
||||
Finalizer((tdb) => {tdb.ffi._releaseTableDb(tdb.id)});
|
||||
Finalizer((tdb) => tdb.ffi._releaseTableDb(tdb.id));
|
||||
|
||||
VeilidTableDBFFI._(this._tdb) {
|
||||
_finalizer.attach(this, _tdb, detach: this);
|
||||
@@ -985,7 +985,7 @@ class VeilidCryptoSystemFFI implements VeilidCryptoSystem {
|
||||
|
||||
final recvPort = ReceivePort("crypto_derive_shared_secret");
|
||||
final sendPort = recvPort.sendPort;
|
||||
_ffi._cryptoHashPassword(
|
||||
_ffi._cryptoDeriveSharedSecret(
|
||||
sendPort.nativePort, _kind, nativeEncodedPassword, nativeEncodedSalt);
|
||||
return processFutureJson(SharedSecret.fromJson, recvPort.first);
|
||||
}
|
||||
|
@@ -30,9 +30,8 @@ class _Ctx {
|
||||
// JS implementation of VeilidRoutingContext
|
||||
class VeilidRoutingContextJS implements VeilidRoutingContext {
|
||||
final _Ctx _ctx;
|
||||
static final Finalizer<_Ctx> _finalizer = Finalizer((ctx) => {
|
||||
js_util.callMethod(wasm, "release_routing_context", [ctx.id])
|
||||
});
|
||||
static final Finalizer<_Ctx> _finalizer = Finalizer(
|
||||
(ctx) => js_util.callMethod(wasm, "release_routing_context", [ctx.id]));
|
||||
|
||||
VeilidRoutingContextJS._(this._ctx) {
|
||||
_finalizer.attach(this, _ctx, detach: this);
|
||||
@@ -338,9 +337,8 @@ class _TDBT {
|
||||
// JS implementation of VeilidTableDBTransaction
|
||||
class VeilidTableDBTransactionJS extends VeilidTableDBTransaction {
|
||||
final _TDBT _tdbt;
|
||||
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) => {
|
||||
js_util.callMethod(wasm, "release_table_db_transaction", [tdbt.id])
|
||||
});
|
||||
static final Finalizer<_TDBT> _finalizer = Finalizer((tdbt) =>
|
||||
js_util.callMethod(wasm, "release_table_db_transaction", [tdbt.id]));
|
||||
|
||||
VeilidTableDBTransactionJS._(this._tdbt) {
|
||||
_finalizer.attach(this, _tdbt, detach: this);
|
||||
@@ -388,9 +386,8 @@ class _TDB {
|
||||
// JS implementation of VeilidTableDB
|
||||
class VeilidTableDBJS extends VeilidTableDB {
|
||||
final _TDB _tdb;
|
||||
static final Finalizer<_TDB> _finalizer = Finalizer((tdb) => {
|
||||
js_util.callMethod(wasm, "release_table_db", [tdb.id])
|
||||
});
|
||||
static final Finalizer<_TDB> _finalizer = Finalizer(
|
||||
(tdb) => js_util.callMethod(wasm, "release_table_db", [tdb.id]));
|
||||
|
||||
VeilidTableDBJS._(this._tdb) {
|
||||
_finalizer.attach(this, _tdb, detach: this);
|
||||
|
@@ -16,17 +16,15 @@ enum AttachmentState {
|
||||
attachedStrong,
|
||||
fullyAttached,
|
||||
overAttached,
|
||||
detaching,
|
||||
}
|
||||
detaching;
|
||||
|
||||
extension AttachmentStateExt on AttachmentState {
|
||||
String toJson() {
|
||||
return name.toPascalCase();
|
||||
}
|
||||
}
|
||||
|
||||
AttachmentState attachmentStateFromJson(String j) {
|
||||
return AttachmentState.values.byName(j.toCamelCase());
|
||||
factory AttachmentState.fromJson(String j) {
|
||||
return AttachmentState.values.byName(j.toCamelCase());
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -37,17 +35,15 @@ enum VeilidLogLevel {
|
||||
warn,
|
||||
info,
|
||||
debug,
|
||||
trace,
|
||||
}
|
||||
trace;
|
||||
|
||||
extension VeilidLogLevelExt on VeilidLogLevel {
|
||||
String toJson() {
|
||||
return name.toPascalCase();
|
||||
}
|
||||
}
|
||||
|
||||
VeilidLogLevel veilidLogLevelFromJson(String j) {
|
||||
return VeilidLogLevel.values.byName(j.toCamelCase());
|
||||
factory VeilidLogLevel.fromJson(String j) {
|
||||
return VeilidLogLevel.values.byName(j.toCamelCase());
|
||||
}
|
||||
}
|
||||
|
||||
////////////
|
||||
@@ -221,7 +217,7 @@ class PeerStats {
|
||||
|
||||
class PeerTableData {
|
||||
List<TypedKey> nodeIds;
|
||||
PeerAddress peerAddress;
|
||||
String peerAddress;
|
||||
PeerStats peerStats;
|
||||
|
||||
PeerTableData({
|
||||
@@ -233,7 +229,7 @@ class PeerTableData {
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'node_ids': nodeIds.map((p) => p.toJson()).toList(),
|
||||
'peer_address': peerAddress.toJson(),
|
||||
'peer_address': peerAddress,
|
||||
'peer_stats': peerStats.toJson(),
|
||||
};
|
||||
}
|
||||
@@ -241,53 +237,10 @@ class PeerTableData {
|
||||
PeerTableData.fromJson(dynamic json)
|
||||
: nodeIds = List<TypedKey>.from(
|
||||
json['node_ids'].map((j) => TypedKey.fromJson(j))),
|
||||
peerAddress = PeerAddress.fromJson(json['peer_address']),
|
||||
peerAddress = json['peer_address'],
|
||||
peerStats = PeerStats.fromJson(json['peer_stats']);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// AttachmentState
|
||||
|
||||
enum ProtocolType {
|
||||
udp,
|
||||
tcp,
|
||||
ws,
|
||||
wss,
|
||||
}
|
||||
|
||||
extension ProtocolTypeExt on ProtocolType {
|
||||
String toJson() {
|
||||
return name.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
ProtocolType protocolTypeFromJson(String j) {
|
||||
return ProtocolType.values.byName(j.toLowerCase());
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
class PeerAddress {
|
||||
ProtocolType protocolType;
|
||||
String socketAddress;
|
||||
|
||||
PeerAddress({
|
||||
required this.protocolType,
|
||||
required this.socketAddress,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'protocol_type': protocolType.toJson(),
|
||||
'socket_address': socketAddress,
|
||||
};
|
||||
}
|
||||
|
||||
PeerAddress.fromJson(dynamic json)
|
||||
: protocolType = protocolTypeFromJson(json['protocol_type']),
|
||||
socketAddress = json['socket_address'];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidUpdate
|
||||
|
||||
@@ -297,7 +250,7 @@ abstract class VeilidUpdate {
|
||||
case "Log":
|
||||
{
|
||||
return VeilidLog(
|
||||
logLevel: veilidLogLevelFromJson(json["log_level"]),
|
||||
logLevel: VeilidLogLevel.fromJson(json["log_level"]),
|
||||
message: json["message"],
|
||||
backtrace: json["backtrace"]);
|
||||
}
|
||||
@@ -509,7 +462,7 @@ class VeilidStateAttachment {
|
||||
this.state, this.publicInternetReady, this.localNetworkReady);
|
||||
|
||||
VeilidStateAttachment.fromJson(dynamic json)
|
||||
: state = attachmentStateFromJson(json['state']),
|
||||
: state = AttachmentState.fromJson(json['state']),
|
||||
publicInternetReady = json['public_internet_ready'],
|
||||
localNetworkReady = json['local_network_ready'];
|
||||
|
||||
|
Reference in New Issue
Block a user