mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
more freezed cleanup
This commit is contained in:
parent
d6999c36a9
commit
6a47363d8c
@ -52,8 +52,8 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
return VeilidConfig(
|
||||
programName: programName,
|
||||
namespace: "",
|
||||
capabilities: VeilidConfigCapabilities(disable: []),
|
||||
protectedStore: VeilidConfigProtectedStore(
|
||||
capabilities: const VeilidConfigCapabilities(disable: []),
|
||||
protectedStore: const VeilidConfigProtectedStore(
|
||||
allowInsecureFallback: false,
|
||||
alwaysUseInsecureStorage: false,
|
||||
directory: "",
|
||||
@ -85,7 +85,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
clientWhitelistTimeoutMs: 300000,
|
||||
reverseConnectionReceiptTimeMs: 5000,
|
||||
holePunchReceiptTimeMs: 5000,
|
||||
routingTable: VeilidConfigRoutingTable(
|
||||
routingTable: const VeilidConfigRoutingTable(
|
||||
nodeId: [],
|
||||
nodeIdSecret: [],
|
||||
bootstrap: kIsWeb
|
||||
@ -97,7 +97,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
limitAttachedGood: 8,
|
||||
limitAttachedWeak: 4,
|
||||
),
|
||||
rpc: VeilidConfigRPC(
|
||||
rpc: const VeilidConfigRPC(
|
||||
concurrency: 0,
|
||||
queueSize: 1024,
|
||||
maxTimestampBehindMs: 10000,
|
||||
@ -129,12 +129,12 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
upnp: true,
|
||||
detectAddressChanges: true,
|
||||
restrictedNatRetries: 0,
|
||||
tls: VeilidConfigTLS(
|
||||
tls: const VeilidConfigTLS(
|
||||
certificatePath: "",
|
||||
privateKeyPath: "",
|
||||
connectionInitialTimeoutMs: 2000,
|
||||
),
|
||||
application: VeilidConfigApplication(
|
||||
application: const VeilidConfigApplication(
|
||||
https: VeilidConfigHTTPS(
|
||||
enabled: false,
|
||||
listenAddress: "",
|
||||
@ -147,7 +147,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
||||
path: "",
|
||||
url: null,
|
||||
)),
|
||||
protocol: VeilidConfigProtocol(
|
||||
protocol: const VeilidConfigProtocol(
|
||||
udp: VeilidConfigUDP(
|
||||
enabled: !kIsWeb,
|
||||
socketPoolSize: 0,
|
||||
|
@ -2,10 +2,14 @@ import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:change_case/change_case.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'veilid_encoding.dart';
|
||||
import 'veilid.dart';
|
||||
|
||||
part 'routing_context.freezed.dart';
|
||||
part 'routing_context.g.dart';
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -56,30 +60,16 @@ class DHTSchemaDFLT implements DHTSchema {
|
||||
}
|
||||
}
|
||||
|
||||
class DHTSchemaMember {
|
||||
PublicKey mKey;
|
||||
int mCnt;
|
||||
@freezed
|
||||
class DHTSchemaMember with _$DHTSchemaMember {
|
||||
@Assert('mCnt >= 0 && mCnt <= 65535', 'value out of range')
|
||||
const factory DHTSchemaMember({
|
||||
required PublicKey mKey,
|
||||
required int mCnt,
|
||||
}) = _DHTSchemaMember;
|
||||
|
||||
DHTSchemaMember({
|
||||
required this.mKey,
|
||||
required this.mCnt,
|
||||
}) {
|
||||
if (mCnt < 0 || mCnt > 65535) {
|
||||
throw VeilidAPIExceptionInvalidArgument(
|
||||
"value out of range", "mCnt", mCnt.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'm_key': mKey,
|
||||
'm_cnt': mCnt,
|
||||
};
|
||||
}
|
||||
|
||||
DHTSchemaMember.fromJson(dynamic json)
|
||||
: mKey = json['m_key'],
|
||||
mCnt = json['m_cnt'];
|
||||
factory DHTSchemaMember.fromJson(Map<String, dynamic> json) =>
|
||||
_$DHTSchemaMemberFromJson(json);
|
||||
}
|
||||
|
||||
class DHTSchemaSMPL implements DHTSchema {
|
||||
|
170
veilid-flutter/lib/routing_context.freezed.dart
Normal file
170
veilid-flutter/lib/routing_context.freezed.dart
Normal file
@ -0,0 +1,170 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'routing_context.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||
|
||||
DHTSchemaMember _$DHTSchemaMemberFromJson(Map<String, dynamic> json) {
|
||||
return _DHTSchemaMember.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DHTSchemaMember {
|
||||
FixedEncodedString43 get mKey => throw _privateConstructorUsedError;
|
||||
int get mCnt => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$DHTSchemaMemberCopyWith<DHTSchemaMember> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DHTSchemaMemberCopyWith<$Res> {
|
||||
factory $DHTSchemaMemberCopyWith(
|
||||
DHTSchemaMember value, $Res Function(DHTSchemaMember) then) =
|
||||
_$DHTSchemaMemberCopyWithImpl<$Res, DHTSchemaMember>;
|
||||
@useResult
|
||||
$Res call({FixedEncodedString43 mKey, int mCnt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DHTSchemaMemberCopyWithImpl<$Res, $Val extends DHTSchemaMember>
|
||||
implements $DHTSchemaMemberCopyWith<$Res> {
|
||||
_$DHTSchemaMemberCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? mKey = null,
|
||||
Object? mCnt = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
mKey: null == mKey
|
||||
? _value.mKey
|
||||
: mKey // ignore: cast_nullable_to_non_nullable
|
||||
as FixedEncodedString43,
|
||||
mCnt: null == mCnt
|
||||
? _value.mCnt
|
||||
: mCnt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$_DHTSchemaMemberCopyWith<$Res>
|
||||
implements $DHTSchemaMemberCopyWith<$Res> {
|
||||
factory _$$_DHTSchemaMemberCopyWith(
|
||||
_$_DHTSchemaMember value, $Res Function(_$_DHTSchemaMember) then) =
|
||||
__$$_DHTSchemaMemberCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({FixedEncodedString43 mKey, int mCnt});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$_DHTSchemaMemberCopyWithImpl<$Res>
|
||||
extends _$DHTSchemaMemberCopyWithImpl<$Res, _$_DHTSchemaMember>
|
||||
implements _$$_DHTSchemaMemberCopyWith<$Res> {
|
||||
__$$_DHTSchemaMemberCopyWithImpl(
|
||||
_$_DHTSchemaMember _value, $Res Function(_$_DHTSchemaMember) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? mKey = null,
|
||||
Object? mCnt = null,
|
||||
}) {
|
||||
return _then(_$_DHTSchemaMember(
|
||||
mKey: null == mKey
|
||||
? _value.mKey
|
||||
: mKey // ignore: cast_nullable_to_non_nullable
|
||||
as FixedEncodedString43,
|
||||
mCnt: null == mCnt
|
||||
? _value.mCnt
|
||||
: mCnt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$_DHTSchemaMember implements _DHTSchemaMember {
|
||||
const _$_DHTSchemaMember({required this.mKey, required this.mCnt})
|
||||
: assert(mCnt >= 0 && mCnt <= 65535, 'value out of range');
|
||||
|
||||
factory _$_DHTSchemaMember.fromJson(Map<String, dynamic> json) =>
|
||||
_$$_DHTSchemaMemberFromJson(json);
|
||||
|
||||
@override
|
||||
final FixedEncodedString43 mKey;
|
||||
@override
|
||||
final int mCnt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DHTSchemaMember(mKey: $mKey, mCnt: $mCnt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$_DHTSchemaMember &&
|
||||
(identical(other.mKey, mKey) || other.mKey == mKey) &&
|
||||
(identical(other.mCnt, mCnt) || other.mCnt == mCnt));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, mKey, mCnt);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$_DHTSchemaMemberCopyWith<_$_DHTSchemaMember> get copyWith =>
|
||||
__$$_DHTSchemaMemberCopyWithImpl<_$_DHTSchemaMember>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$_DHTSchemaMemberToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _DHTSchemaMember implements DHTSchemaMember {
|
||||
const factory _DHTSchemaMember(
|
||||
{required final FixedEncodedString43 mKey,
|
||||
required final int mCnt}) = _$_DHTSchemaMember;
|
||||
|
||||
factory _DHTSchemaMember.fromJson(Map<String, dynamic> json) =
|
||||
_$_DHTSchemaMember.fromJson;
|
||||
|
||||
@override
|
||||
FixedEncodedString43 get mKey;
|
||||
@override
|
||||
int get mCnt;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$_DHTSchemaMemberCopyWith<_$_DHTSchemaMember> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
19
veilid-flutter/lib/routing_context.g.dart
Normal file
19
veilid-flutter/lib/routing_context.g.dart
Normal file
@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'routing_context.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$_DHTSchemaMember _$$_DHTSchemaMemberFromJson(Map<String, dynamic> json) =>
|
||||
_$_DHTSchemaMember(
|
||||
mKey: FixedEncodedString43.fromJson(json['m_key']),
|
||||
mCnt: json['m_cnt'] as int,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_DHTSchemaMemberToJson(_$_DHTSchemaMember instance) =>
|
||||
<String, dynamic>{
|
||||
'm_key': instance.mKey.toJson(),
|
||||
'm_cnt': instance.mCnt,
|
||||
};
|
@ -30,7 +30,7 @@ class VeilidFFIConfigLoggingOtlp with _$VeilidFFIConfigLoggingOtlp {
|
||||
required String serviceName,
|
||||
}) = _VeilidFFIConfigLoggingOtlp;
|
||||
|
||||
factory VeilidFFIConfigLoggingOtlp.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidFFIConfigLoggingOtlp.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidFFIConfigLoggingOtlpFromJson(json);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class VeilidFFIConfigLoggingApi with _$VeilidFFIConfigLoggingApi {
|
||||
required VeilidConfigLogLevel level,
|
||||
}) = _VeilidFFIConfigLoggingApi;
|
||||
|
||||
factory VeilidFFIConfigLoggingApi.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidFFIConfigLoggingApi.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidFFIConfigLoggingApiFromJson(json);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class VeilidFFIConfigLogging with _$VeilidFFIConfigLogging {
|
||||
required VeilidFFIConfigLoggingOtlp otlp,
|
||||
required VeilidFFIConfigLoggingApi api}) = _VeilidFFIConfigLogging;
|
||||
|
||||
factory VeilidFFIConfigLogging.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidFFIConfigLogging.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidFFIConfigLoggingFromJson(json);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class VeilidFFIConfig with _$VeilidFFIConfig {
|
||||
required VeilidFFIConfigLogging logging,
|
||||
}) = _VeilidFFIConfig;
|
||||
|
||||
factory VeilidFFIConfig.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidFFIConfig.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidFFIConfigFromJson(json);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ class VeilidWASMConfigLoggingPerformance
|
||||
}) = _VeilidWASMConfigLoggingPerformance;
|
||||
|
||||
factory VeilidWASMConfigLoggingPerformance.fromJson(
|
||||
Map<String, Object?> json) =>
|
||||
Map<String, dynamic> json) =>
|
||||
_$VeilidWASMConfigLoggingPerformanceFromJson(json);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class VeilidWASMConfigLoggingApi with _$VeilidWASMConfigLoggingApi {
|
||||
required VeilidConfigLogLevel level,
|
||||
}) = _VeilidWASMConfigLoggingApi;
|
||||
|
||||
factory VeilidWASMConfigLoggingApi.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidWASMConfigLoggingApi.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidWASMConfigLoggingApiFromJson(json);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class VeilidWASMConfigLogging with _$VeilidWASMConfigLogging {
|
||||
{required VeilidWASMConfigLoggingPerformance performance,
|
||||
required VeilidWASMConfigLoggingApi api}) = _VeilidWASMConfigLogging;
|
||||
|
||||
factory VeilidWASMConfigLogging.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidWASMConfigLogging.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidWASMConfigLoggingFromJson(json);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class VeilidWASMConfig with _$VeilidWASMConfig {
|
||||
required VeilidWASMConfigLogging logging,
|
||||
}) = _VeilidWASMConfig;
|
||||
|
||||
factory VeilidWASMConfig.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidWASMConfig.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidWASMConfigFromJson(json);
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ class VeilidConfigHTTPS with _$VeilidConfigHTTPS {
|
||||
String? url,
|
||||
}) = _VeilidConfigHTTPS;
|
||||
|
||||
factory VeilidConfigHTTPS.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigHTTPS.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigHTTPSFromJson(json);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ class VeilidConfigHTTP with _$VeilidConfigHTTP {
|
||||
String? url,
|
||||
}) = _VeilidConfigHTTP;
|
||||
|
||||
factory VeilidConfigHTTP.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigHTTP.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigHTTPFromJson(json);
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ class VeilidConfigApplication with _$VeilidConfigApplication {
|
||||
required VeilidConfigHTTP http,
|
||||
}) = _VeilidConfigApplication;
|
||||
|
||||
factory VeilidConfigApplication.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigApplication.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigApplicationFromJson(json);
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ class VeilidConfigUDP with _$VeilidConfigUDP {
|
||||
required String listenAddress,
|
||||
String? publicAddress}) = _VeilidConfigUDP;
|
||||
|
||||
factory VeilidConfigUDP.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigUDP.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigUDPFromJson(json);
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class VeilidConfigTCP with _$VeilidConfigTCP {
|
||||
required String listenAddress,
|
||||
String? publicAddress}) = _VeilidConfigTCP;
|
||||
|
||||
factory VeilidConfigTCP.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigTCP.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigTCPFromJson(json);
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ class VeilidConfigWS with _$VeilidConfigWS {
|
||||
required String path,
|
||||
String? url}) = _VeilidConfigWS;
|
||||
|
||||
factory VeilidConfigWS.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigWS.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigWSFromJson(json);
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ class VeilidConfigWSS with _$VeilidConfigWSS {
|
||||
required String path,
|
||||
String? url}) = _VeilidConfigWSS;
|
||||
|
||||
factory VeilidConfigWSS.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigWSS.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigWSSFromJson(json);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ class VeilidConfigProtocol with _$VeilidConfigProtocol {
|
||||
required VeilidConfigWSS wss,
|
||||
}) = _VeilidConfigProtocol;
|
||||
|
||||
factory VeilidConfigProtocol.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigProtocol.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigProtocolFromJson(json);
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ class VeilidConfigTLS with _$VeilidConfigTLS {
|
||||
required int connectionInitialTimeoutMs,
|
||||
}) = _VeilidConfigTLS;
|
||||
|
||||
factory VeilidConfigTLS.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigTLS.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigTLSFromJson(json);
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ class VeilidConfigDHT with _$VeilidConfigDHT {
|
||||
required int remoteMaxSubkeyCacheMemoryMb,
|
||||
required int remoteMaxStorageSpaceMb}) = _VeilidConfigDHT;
|
||||
|
||||
factory VeilidConfigDHT.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigDHT.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigDHTFromJson(json);
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ class VeilidConfigRPC with _$VeilidConfigRPC {
|
||||
required int maxRouteHopCount,
|
||||
required int defaultRouteHopCount}) = _VeilidConfigRPC;
|
||||
|
||||
factory VeilidConfigRPC.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigRPC.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigRPCFromJson(json);
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ class VeilidConfigRoutingTable with _$VeilidConfigRoutingTable {
|
||||
required int limitAttachedWeak,
|
||||
}) = _VeilidConfigRoutingTable;
|
||||
|
||||
factory VeilidConfigRoutingTable.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigRoutingTable.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigRoutingTableFromJson(json);
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ class VeilidConfigNetwork with _$VeilidConfigNetwork {
|
||||
required VeilidConfigProtocol protocol,
|
||||
}) = _VeilidConfigNetwork;
|
||||
|
||||
factory VeilidConfigNetwork.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigNetwork.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigNetworkFromJson(json);
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ class VeilidConfigTableStore with _$VeilidConfigTableStore {
|
||||
required bool delete,
|
||||
}) = _VeilidConfigTableStore;
|
||||
|
||||
factory VeilidConfigTableStore.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigTableStore.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigTableStoreFromJson(json);
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ class VeilidConfigBlockStore with _$VeilidConfigBlockStore {
|
||||
required bool delete,
|
||||
}) = _VeilidConfigBlockStore;
|
||||
|
||||
factory VeilidConfigBlockStore.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigBlockStore.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigBlockStoreFromJson(json);
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ class VeilidConfigProtectedStore with _$VeilidConfigProtectedStore {
|
||||
required String deviceEncryptionKeyPassword,
|
||||
String? newDeviceEncryptionKeyPassword}) = _VeilidConfigProtectedStore;
|
||||
|
||||
factory VeilidConfigProtectedStore.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigProtectedStore.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigProtectedStoreFromJson(json);
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ class VeilidConfigCapabilities with _$VeilidConfigCapabilities {
|
||||
required List<String> disable,
|
||||
}) = _VeilidConfigCapabilities;
|
||||
|
||||
factory VeilidConfigCapabilities.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfigCapabilities.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigCapabilitiesFromJson(json);
|
||||
}
|
||||
|
||||
@ -427,6 +427,6 @@ class VeilidConfig with _$VeilidConfig {
|
||||
required VeilidConfigNetwork network,
|
||||
}) = _VeilidConfig;
|
||||
|
||||
factory VeilidConfig.fromJson(Map<String, Object?> json) =>
|
||||
factory VeilidConfig.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidConfigFromJson(json);
|
||||
}
|
||||
|
@ -23,6 +23,15 @@ Uint8List base64UrlNoPadDecodeDynamic(dynamic source) {
|
||||
return base64.decode(source);
|
||||
}
|
||||
|
||||
class Uint8ListJsonConverter implements JsonConverter<Uint8List, String> {
|
||||
const Uint8ListJsonConverter();
|
||||
|
||||
@override
|
||||
Uint8List fromJson(String json) => base64UrlNoPadDecode(json);
|
||||
@override
|
||||
String toJson(Uint8List data) => base64UrlNoPadEncode(data);
|
||||
}
|
||||
|
||||
@immutable
|
||||
abstract class EncodedString extends Equatable {
|
||||
final String contents;
|
||||
|
@ -367,7 +367,7 @@ Future<T> processFuturePlain<T>(Future<dynamic> future) {
|
||||
}
|
||||
|
||||
Future<T> processFutureJson<T>(
|
||||
T Function(dynamic) jsonConstructor, Future<dynamic> future) {
|
||||
T Function(Map<String, dynamic>) jsonConstructor, Future<dynamic> future) {
|
||||
return future.then((value) {
|
||||
final list = value as List<dynamic>;
|
||||
switch (list[0] as int) {
|
||||
|
@ -52,7 +52,7 @@ class LatencyStats with _$LatencyStats {
|
||||
required TimestampDuration slowest,
|
||||
}) = _LatencyStats;
|
||||
|
||||
factory LatencyStats.fromJson(Map<String, Object?> json) =>
|
||||
factory LatencyStats.fromJson(Map<String, dynamic> json) =>
|
||||
_$LatencyStatsFromJson(json);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ class TransferStats with _$TransferStats {
|
||||
required BigInt minimum,
|
||||
}) = _TransferStats;
|
||||
|
||||
factory TransferStats.fromJson(Map<String, Object?> json) =>
|
||||
factory TransferStats.fromJson(Map<String, dynamic> json) =>
|
||||
_$TransferStatsFromJson(json);
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ class TransferStatsDownUp with _$TransferStatsDownUp {
|
||||
required TransferStats up,
|
||||
}) = _TransferStatsDownUp;
|
||||
|
||||
factory TransferStatsDownUp.fromJson(Map<String, Object?> json) =>
|
||||
factory TransferStatsDownUp.fromJson(Map<String, dynamic> json) =>
|
||||
_$TransferStatsDownUpFromJson(json);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ class RPCStats with _$RPCStats {
|
||||
required int failedToSend,
|
||||
}) = _RPCStats;
|
||||
|
||||
factory RPCStats.fromJson(Map<String, Object?> json) =>
|
||||
factory RPCStats.fromJson(Map<String, dynamic> json) =>
|
||||
_$RPCStatsFromJson(json);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class PeerStats with _$PeerStats {
|
||||
required TransferStatsDownUp transfer,
|
||||
}) = _PeerStats;
|
||||
|
||||
factory PeerStats.fromJson(Map<String, Object?> json) =>
|
||||
factory PeerStats.fromJson(Map<String, dynamic> json) =>
|
||||
_$PeerStatsFromJson(json);
|
||||
}
|
||||
|
||||
@ -128,314 +128,109 @@ class PeerTableData with _$PeerTableData {
|
||||
required PeerStats peerStats,
|
||||
}) = _PeerTableData;
|
||||
|
||||
factory PeerTableData.fromJson(Map<String, Object?> json) =>
|
||||
factory PeerTableData.fromJson(Map<String, dynamic> json) =>
|
||||
_$PeerTableDataFromJson(json);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidUpdate
|
||||
|
||||
abstract class VeilidUpdate {
|
||||
factory VeilidUpdate.fromJson(dynamic json) {
|
||||
switch (json["kind"]) {
|
||||
case "Log":
|
||||
{
|
||||
return VeilidLog(
|
||||
logLevel: VeilidLogLevel.fromJson(json["log_level"]),
|
||||
message: json["message"],
|
||||
backtrace: json["backtrace"]);
|
||||
}
|
||||
case "AppMessage":
|
||||
{
|
||||
return VeilidAppMessage(
|
||||
sender: json["sender"], message: json["message"]);
|
||||
}
|
||||
case "AppCall":
|
||||
{
|
||||
return VeilidAppCall(
|
||||
sender: json["sender"],
|
||||
message: json["message"],
|
||||
callId: json["call_id"]);
|
||||
}
|
||||
case "Attachment":
|
||||
{
|
||||
return VeilidUpdateAttachment(
|
||||
state: VeilidStateAttachment.fromJson(json));
|
||||
}
|
||||
case "Network":
|
||||
{
|
||||
return VeilidUpdateNetwork(state: VeilidStateNetwork.fromJson(json));
|
||||
}
|
||||
case "Config":
|
||||
{
|
||||
return VeilidUpdateConfig(state: VeilidStateConfig.fromJson(json));
|
||||
}
|
||||
case "RouteChange":
|
||||
{
|
||||
return VeilidUpdateRouteChange(
|
||||
deadRoutes: List<String>.from(json['dead_routes'].map((j) => j)),
|
||||
deadRemoteRoutes:
|
||||
List<String>.from(json['dead_remote_routes'].map((j) => j)));
|
||||
}
|
||||
case "ValueChange":
|
||||
{
|
||||
return VeilidUpdateValueChange(
|
||||
key: TypedKey.fromJson(json['key']),
|
||||
subkeys: List<ValueSubkeyRange>.from(
|
||||
json['subkeys'].map((j) => ValueSubkeyRange.fromJson(j))),
|
||||
count: json['count'],
|
||||
valueData: ValueData.fromJson(json['value_data']));
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw VeilidAPIExceptionInternal(
|
||||
"Invalid VeilidAPIException type: ${json['kind']}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, dynamic> toJson();
|
||||
}
|
||||
@Freezed(unionKey: 'kind', unionValueCase: FreezedUnionCase.pascal)
|
||||
sealed class VeilidUpdate with _$VeilidUpdate {
|
||||
const factory VeilidUpdate.log({
|
||||
required VeilidLogLevel logLevel,
|
||||
required String message,
|
||||
String? backtrace,
|
||||
}) = VeilidLog;
|
||||
const factory VeilidUpdate.appMessage({
|
||||
TypedKey? sender,
|
||||
@Uint8ListJsonConverter() required Uint8List message,
|
||||
}) = VeilidAppMessage;
|
||||
const factory VeilidUpdate.appCall({
|
||||
TypedKey? sender,
|
||||
@Uint8ListJsonConverter() required Uint8List message,
|
||||
required String callId,
|
||||
}) = VeilidAppCall;
|
||||
const factory VeilidUpdate.attachment(
|
||||
{required AttachmentState state,
|
||||
required bool publicInternetReady,
|
||||
required bool localNetworkReady}) = VeilidUpdateAttachment;
|
||||
const factory VeilidUpdate.network(
|
||||
{required bool started,
|
||||
required BigInt bpsDown,
|
||||
required BigInt bpsUp,
|
||||
required List<PeerTableData> peers}) = VeilidUpdateNetwork;
|
||||
const factory VeilidUpdate.config({
|
||||
required VeilidConfig config,
|
||||
}) = VeilidUpdateConfig;
|
||||
const factory VeilidUpdate.routeChange({
|
||||
required List<String> deadRoutes,
|
||||
required List<String> deadRemoteRoutes,
|
||||
}) = VeilidUpdateRouteChange;
|
||||
const factory VeilidUpdate.valueChange({
|
||||
required TypedKey key,
|
||||
required List<ValueSubkeyRange> subkeys,
|
||||
required int count,
|
||||
required ValueData valueData,
|
||||
}) = VeilidUpdateValueChange;
|
||||
|
||||
class VeilidLog implements VeilidUpdate {
|
||||
final VeilidLogLevel logLevel;
|
||||
final String message;
|
||||
final String? backtrace;
|
||||
//
|
||||
VeilidLog({
|
||||
required this.logLevel,
|
||||
required this.message,
|
||||
required this.backtrace,
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'kind': "Log",
|
||||
'log_level': logLevel.toJson(),
|
||||
'message': message,
|
||||
'backtrace': backtrace
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidAppMessage implements VeilidUpdate {
|
||||
final TypedKey? sender;
|
||||
final Uint8List message;
|
||||
|
||||
//
|
||||
VeilidAppMessage({
|
||||
required this.sender,
|
||||
required this.message,
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'kind': "AppMessage",
|
||||
'sender': sender,
|
||||
'message': base64UrlNoPadEncode(message)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidAppCall implements VeilidUpdate {
|
||||
final String? sender;
|
||||
final Uint8List message;
|
||||
final String callId;
|
||||
|
||||
//
|
||||
VeilidAppCall({
|
||||
required this.sender,
|
||||
required this.message,
|
||||
required this.callId,
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'kind': "AppCall",
|
||||
'sender': sender,
|
||||
'message': base64UrlNoPadEncode(message),
|
||||
'call_id': callId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidUpdateAttachment implements VeilidUpdate {
|
||||
final VeilidStateAttachment state;
|
||||
//
|
||||
VeilidUpdateAttachment({required this.state});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
var jsonRep = state.toJson();
|
||||
jsonRep['kind'] = "Attachment";
|
||||
return jsonRep;
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidUpdateNetwork implements VeilidUpdate {
|
||||
final VeilidStateNetwork state;
|
||||
//
|
||||
VeilidUpdateNetwork({required this.state});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
var jsonRep = state.toJson();
|
||||
jsonRep['kind'] = "Network";
|
||||
return jsonRep;
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidUpdateConfig implements VeilidUpdate {
|
||||
final VeilidStateConfig state;
|
||||
//
|
||||
VeilidUpdateConfig({required this.state});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
var jsonRep = state.toJson();
|
||||
jsonRep['kind'] = "Config";
|
||||
return jsonRep;
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidUpdateRouteChange implements VeilidUpdate {
|
||||
final List<String> deadRoutes;
|
||||
final List<String> deadRemoteRoutes;
|
||||
//
|
||||
VeilidUpdateRouteChange({
|
||||
required this.deadRoutes,
|
||||
required this.deadRemoteRoutes,
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'dead_routes': deadRoutes.map((p) => p).toList(),
|
||||
'dead_remote_routes': deadRemoteRoutes.map((p) => p).toList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class VeilidUpdateValueChange implements VeilidUpdate {
|
||||
final TypedKey key;
|
||||
final List<ValueSubkeyRange> subkeys;
|
||||
final int count;
|
||||
final ValueData valueData;
|
||||
|
||||
//
|
||||
VeilidUpdateValueChange({
|
||||
required this.key,
|
||||
required this.subkeys,
|
||||
required this.count,
|
||||
required this.valueData,
|
||||
});
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'key': key.toJson(),
|
||||
'subkeys': subkeys.map((p) => p.toJson()).toList(),
|
||||
'count': count,
|
||||
'value_data': valueData.toJson(),
|
||||
};
|
||||
}
|
||||
factory VeilidUpdate.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateFromJson(json);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidStateAttachment
|
||||
|
||||
class VeilidStateAttachment {
|
||||
final AttachmentState state;
|
||||
final bool publicInternetReady;
|
||||
final bool localNetworkReady;
|
||||
@freezed
|
||||
class VeilidStateAttachment with _$VeilidStateAttachment {
|
||||
const factory VeilidStateAttachment(
|
||||
{required AttachmentState state,
|
||||
required bool publicInternetReady,
|
||||
required bool localNetworkReady}) = _VeilidStateAttachment;
|
||||
|
||||
VeilidStateAttachment(
|
||||
this.state, this.publicInternetReady, this.localNetworkReady);
|
||||
|
||||
VeilidStateAttachment.fromJson(dynamic json)
|
||||
: state = AttachmentState.fromJson(json['state']),
|
||||
publicInternetReady = json['public_internet_ready'],
|
||||
localNetworkReady = json['local_network_ready'];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'state': state.toJson(),
|
||||
'public_internet_ready': publicInternetReady,
|
||||
'local_network_ready': localNetworkReady,
|
||||
};
|
||||
}
|
||||
factory VeilidStateAttachment.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidStateAttachmentFromJson(json);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidStateNetwork
|
||||
|
||||
class VeilidStateNetwork {
|
||||
final bool started;
|
||||
final BigInt bpsDown;
|
||||
final BigInt bpsUp;
|
||||
final List<PeerTableData> peers;
|
||||
@freezed
|
||||
class VeilidStateNetwork with _$VeilidStateNetwork {
|
||||
const factory VeilidStateNetwork(
|
||||
{required bool started,
|
||||
required BigInt bpsDown,
|
||||
required BigInt bpsUp,
|
||||
required List<PeerTableData> peers}) = _VeilidStateNetwork;
|
||||
|
||||
VeilidStateNetwork(
|
||||
{required this.started,
|
||||
required this.bpsDown,
|
||||
required this.bpsUp,
|
||||
required this.peers});
|
||||
|
||||
VeilidStateNetwork.fromJson(dynamic json)
|
||||
: started = json['started'],
|
||||
bpsDown = BigInt.parse(json['bps_down']),
|
||||
bpsUp = BigInt.parse(json['bps_up']),
|
||||
peers = List<PeerTableData>.from(
|
||||
json['peers'].map((j) => PeerTableData.fromJson(j)));
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'started': started,
|
||||
'bps_down': bpsDown.toString(),
|
||||
'bps_up': bpsUp.toString(),
|
||||
'peers': peers.map((p) => p.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
factory VeilidStateNetwork.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidStateNetworkFromJson(json);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidStateConfig
|
||||
|
||||
class VeilidStateConfig {
|
||||
final VeilidConfig config;
|
||||
@freezed
|
||||
class VeilidStateConfig with _$VeilidStateConfig {
|
||||
const factory VeilidStateConfig({
|
||||
required VeilidConfig config,
|
||||
}) = _VeilidStateConfig;
|
||||
|
||||
VeilidStateConfig({
|
||||
required this.config,
|
||||
});
|
||||
|
||||
VeilidStateConfig.fromJson(dynamic json)
|
||||
: config = VeilidConfig.fromJson(json['config']);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'config': config.toJson()};
|
||||
}
|
||||
factory VeilidStateConfig.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidStateConfigFromJson(json);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
/// VeilidState
|
||||
|
||||
class VeilidState {
|
||||
final VeilidStateAttachment attachment;
|
||||
final VeilidStateNetwork network;
|
||||
final VeilidStateConfig config;
|
||||
@freezed
|
||||
class VeilidState with _$VeilidState {
|
||||
const factory VeilidState({
|
||||
required VeilidStateAttachment attachment,
|
||||
required VeilidStateNetwork network,
|
||||
required VeilidStateConfig config,
|
||||
}) = _VeilidState;
|
||||
|
||||
VeilidState.fromJson(dynamic json)
|
||||
: attachment = VeilidStateAttachment.fromJson(json['attachment']),
|
||||
network = VeilidStateNetwork.fromJson(json['network']),
|
||||
config = VeilidStateConfig.fromJson(json['config']);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'attachment': attachment.toJson(),
|
||||
'network': network.toJson(),
|
||||
'config': config.toJson()
|
||||
};
|
||||
}
|
||||
factory VeilidState.fromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidStateFromJson(json);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -112,3 +112,213 @@ Map<String, dynamic> _$$_PeerTableDataToJson(_$_PeerTableData instance) =>
|
||||
'peer_address': instance.peerAddress,
|
||||
'peer_stats': instance.peerStats.toJson(),
|
||||
};
|
||||
|
||||
_$VeilidLog _$$VeilidLogFromJson(Map<String, dynamic> json) => _$VeilidLog(
|
||||
logLevel: VeilidLogLevel.fromJson(json['log_level'] as String),
|
||||
message: json['message'] as String,
|
||||
backtrace: json['backtrace'] as String?,
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidLogToJson(_$VeilidLog instance) =>
|
||||
<String, dynamic>{
|
||||
'log_level': instance.logLevel.toJson(),
|
||||
'message': instance.message,
|
||||
'backtrace': instance.backtrace,
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidAppMessage _$$VeilidAppMessageFromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidAppMessage(
|
||||
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),
|
||||
'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,
|
||||
$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,
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidUpdateAttachment _$$VeilidUpdateAttachmentFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateAttachment(
|
||||
state: AttachmentState.fromJson(json['state'] as String),
|
||||
publicInternetReady: json['public_internet_ready'] as bool,
|
||||
localNetworkReady: json['local_network_ready'] as bool,
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidUpdateAttachmentToJson(
|
||||
_$VeilidUpdateAttachment instance) =>
|
||||
<String, dynamic>{
|
||||
'state': instance.state.toJson(),
|
||||
'public_internet_ready': instance.publicInternetReady,
|
||||
'local_network_ready': instance.localNetworkReady,
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidUpdateNetwork _$$VeilidUpdateNetworkFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateNetwork(
|
||||
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(),
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidUpdateNetworkToJson(
|
||||
_$VeilidUpdateNetwork instance) =>
|
||||
<String, dynamic>{
|
||||
'started': instance.started,
|
||||
'bps_down': instance.bpsDown.toString(),
|
||||
'bps_up': instance.bpsUp.toString(),
|
||||
'peers': instance.peers.map((e) => e.toJson()).toList(),
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidUpdateConfig _$$VeilidUpdateConfigFromJson(Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateConfig(
|
||||
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidUpdateConfigToJson(
|
||||
_$VeilidUpdateConfig instance) =>
|
||||
<String, dynamic>{
|
||||
'config': instance.config.toJson(),
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidUpdateRouteChange _$$VeilidUpdateRouteChangeFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateRouteChange(
|
||||
deadRoutes: (json['dead_routes'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
deadRemoteRoutes: (json['dead_remote_routes'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidUpdateRouteChangeToJson(
|
||||
_$VeilidUpdateRouteChange instance) =>
|
||||
<String, dynamic>{
|
||||
'dead_routes': instance.deadRoutes,
|
||||
'dead_remote_routes': instance.deadRemoteRoutes,
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$VeilidUpdateValueChange _$$VeilidUpdateValueChangeFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$VeilidUpdateValueChange(
|
||||
key: Typed<FixedEncodedString43>.fromJson(json['key']),
|
||||
subkeys: (json['subkeys'] as List<dynamic>)
|
||||
.map(ValueSubkeyRange.fromJson)
|
||||
.toList(),
|
||||
count: json['count'] as int,
|
||||
valueData: ValueData.fromJson(json['value_data']),
|
||||
$type: json['kind'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$VeilidUpdateValueChangeToJson(
|
||||
_$VeilidUpdateValueChange instance) =>
|
||||
<String, dynamic>{
|
||||
'key': instance.key.toJson(),
|
||||
'subkeys': instance.subkeys.map((e) => e.toJson()).toList(),
|
||||
'count': instance.count,
|
||||
'value_data': instance.valueData.toJson(),
|
||||
'kind': instance.$type,
|
||||
};
|
||||
|
||||
_$_VeilidStateAttachment _$$_VeilidStateAttachmentFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$_VeilidStateAttachment(
|
||||
state: AttachmentState.fromJson(json['state'] as String),
|
||||
publicInternetReady: json['public_internet_ready'] as bool,
|
||||
localNetworkReady: json['local_network_ready'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_VeilidStateAttachmentToJson(
|
||||
_$_VeilidStateAttachment instance) =>
|
||||
<String, dynamic>{
|
||||
'state': instance.state.toJson(),
|
||||
'public_internet_ready': instance.publicInternetReady,
|
||||
'local_network_ready': instance.localNetworkReady,
|
||||
};
|
||||
|
||||
_$_VeilidStateNetwork _$$_VeilidStateNetworkFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$_VeilidStateNetwork(
|
||||
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(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_VeilidStateNetworkToJson(
|
||||
_$_VeilidStateNetwork instance) =>
|
||||
<String, dynamic>{
|
||||
'started': instance.started,
|
||||
'bps_down': instance.bpsDown.toString(),
|
||||
'bps_up': instance.bpsUp.toString(),
|
||||
'peers': instance.peers.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
||||
_$_VeilidStateConfig _$$_VeilidStateConfigFromJson(Map<String, dynamic> json) =>
|
||||
_$_VeilidStateConfig(
|
||||
config: VeilidConfig.fromJson(json['config'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_VeilidStateConfigToJson(
|
||||
_$_VeilidStateConfig instance) =>
|
||||
<String, dynamic>{
|
||||
'config': instance.config.toJson(),
|
||||
};
|
||||
|
||||
_$_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>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_VeilidStateToJson(_$_VeilidState instance) =>
|
||||
<String, dynamic>{
|
||||
'attachment': instance.attachment.toJson(),
|
||||
'network': instance.network.toJson(),
|
||||
'config': instance.config.toJson(),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user