more freezed cleanup
This commit is contained in:
parent
d6999c36a9
commit
6a47363d8c
@ -52,8 +52,8 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
|||||||
return VeilidConfig(
|
return VeilidConfig(
|
||||||
programName: programName,
|
programName: programName,
|
||||||
namespace: "",
|
namespace: "",
|
||||||
capabilities: VeilidConfigCapabilities(disable: []),
|
capabilities: const VeilidConfigCapabilities(disable: []),
|
||||||
protectedStore: VeilidConfigProtectedStore(
|
protectedStore: const VeilidConfigProtectedStore(
|
||||||
allowInsecureFallback: false,
|
allowInsecureFallback: false,
|
||||||
alwaysUseInsecureStorage: false,
|
alwaysUseInsecureStorage: false,
|
||||||
directory: "",
|
directory: "",
|
||||||
@ -85,7 +85,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
|||||||
clientWhitelistTimeoutMs: 300000,
|
clientWhitelistTimeoutMs: 300000,
|
||||||
reverseConnectionReceiptTimeMs: 5000,
|
reverseConnectionReceiptTimeMs: 5000,
|
||||||
holePunchReceiptTimeMs: 5000,
|
holePunchReceiptTimeMs: 5000,
|
||||||
routingTable: VeilidConfigRoutingTable(
|
routingTable: const VeilidConfigRoutingTable(
|
||||||
nodeId: [],
|
nodeId: [],
|
||||||
nodeIdSecret: [],
|
nodeIdSecret: [],
|
||||||
bootstrap: kIsWeb
|
bootstrap: kIsWeb
|
||||||
@ -97,7 +97,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
|||||||
limitAttachedGood: 8,
|
limitAttachedGood: 8,
|
||||||
limitAttachedWeak: 4,
|
limitAttachedWeak: 4,
|
||||||
),
|
),
|
||||||
rpc: VeilidConfigRPC(
|
rpc: const VeilidConfigRPC(
|
||||||
concurrency: 0,
|
concurrency: 0,
|
||||||
queueSize: 1024,
|
queueSize: 1024,
|
||||||
maxTimestampBehindMs: 10000,
|
maxTimestampBehindMs: 10000,
|
||||||
@ -129,12 +129,12 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
|||||||
upnp: true,
|
upnp: true,
|
||||||
detectAddressChanges: true,
|
detectAddressChanges: true,
|
||||||
restrictedNatRetries: 0,
|
restrictedNatRetries: 0,
|
||||||
tls: VeilidConfigTLS(
|
tls: const VeilidConfigTLS(
|
||||||
certificatePath: "",
|
certificatePath: "",
|
||||||
privateKeyPath: "",
|
privateKeyPath: "",
|
||||||
connectionInitialTimeoutMs: 2000,
|
connectionInitialTimeoutMs: 2000,
|
||||||
),
|
),
|
||||||
application: VeilidConfigApplication(
|
application: const VeilidConfigApplication(
|
||||||
https: VeilidConfigHTTPS(
|
https: VeilidConfigHTTPS(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
listenAddress: "",
|
listenAddress: "",
|
||||||
@ -147,7 +147,7 @@ Future<VeilidConfig> getDefaultVeilidConfig(String programName) async {
|
|||||||
path: "",
|
path: "",
|
||||||
url: null,
|
url: null,
|
||||||
)),
|
)),
|
||||||
protocol: VeilidConfigProtocol(
|
protocol: const VeilidConfigProtocol(
|
||||||
udp: VeilidConfigUDP(
|
udp: VeilidConfigUDP(
|
||||||
enabled: !kIsWeb,
|
enabled: !kIsWeb,
|
||||||
socketPoolSize: 0,
|
socketPoolSize: 0,
|
||||||
|
@ -2,10 +2,14 @@ import 'dart:async';
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:change_case/change_case.dart';
|
import 'package:change_case/change_case.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
import 'veilid_encoding.dart';
|
import 'veilid_encoding.dart';
|
||||||
import 'veilid.dart';
|
import 'veilid.dart';
|
||||||
|
|
||||||
|
part 'routing_context.freezed.dart';
|
||||||
|
part 'routing_context.g.dart';
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
@ -56,30 +60,16 @@ class DHTSchemaDFLT implements DHTSchema {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DHTSchemaMember {
|
@freezed
|
||||||
PublicKey mKey;
|
class DHTSchemaMember with _$DHTSchemaMember {
|
||||||
int mCnt;
|
@Assert('mCnt >= 0 && mCnt <= 65535', 'value out of range')
|
||||||
|
const factory DHTSchemaMember({
|
||||||
|
required PublicKey mKey,
|
||||||
|
required int mCnt,
|
||||||
|
}) = _DHTSchemaMember;
|
||||||
|
|
||||||
DHTSchemaMember({
|
factory DHTSchemaMember.fromJson(Map<String, dynamic> json) =>
|
||||||
required this.mKey,
|
_$DHTSchemaMemberFromJson(json);
|
||||||
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'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DHTSchemaSMPL implements DHTSchema {
|
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,
|
required String serviceName,
|
||||||
}) = _VeilidFFIConfigLoggingOtlp;
|
}) = _VeilidFFIConfigLoggingOtlp;
|
||||||
|
|
||||||
factory VeilidFFIConfigLoggingOtlp.fromJson(Map<String, Object?> json) =>
|
factory VeilidFFIConfigLoggingOtlp.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidFFIConfigLoggingOtlpFromJson(json);
|
_$VeilidFFIConfigLoggingOtlpFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class VeilidFFIConfigLoggingApi with _$VeilidFFIConfigLoggingApi {
|
|||||||
required VeilidConfigLogLevel level,
|
required VeilidConfigLogLevel level,
|
||||||
}) = _VeilidFFIConfigLoggingApi;
|
}) = _VeilidFFIConfigLoggingApi;
|
||||||
|
|
||||||
factory VeilidFFIConfigLoggingApi.fromJson(Map<String, Object?> json) =>
|
factory VeilidFFIConfigLoggingApi.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidFFIConfigLoggingApiFromJson(json);
|
_$VeilidFFIConfigLoggingApiFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class VeilidFFIConfigLogging with _$VeilidFFIConfigLogging {
|
|||||||
required VeilidFFIConfigLoggingOtlp otlp,
|
required VeilidFFIConfigLoggingOtlp otlp,
|
||||||
required VeilidFFIConfigLoggingApi api}) = _VeilidFFIConfigLogging;
|
required VeilidFFIConfigLoggingApi api}) = _VeilidFFIConfigLogging;
|
||||||
|
|
||||||
factory VeilidFFIConfigLogging.fromJson(Map<String, Object?> json) =>
|
factory VeilidFFIConfigLogging.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidFFIConfigLoggingFromJson(json);
|
_$VeilidFFIConfigLoggingFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class VeilidFFIConfig with _$VeilidFFIConfig {
|
|||||||
required VeilidFFIConfigLogging logging,
|
required VeilidFFIConfigLogging logging,
|
||||||
}) = _VeilidFFIConfig;
|
}) = _VeilidFFIConfig;
|
||||||
|
|
||||||
factory VeilidFFIConfig.fromJson(Map<String, Object?> json) =>
|
factory VeilidFFIConfig.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidFFIConfigFromJson(json);
|
_$VeilidFFIConfigFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class VeilidWASMConfigLoggingPerformance
|
|||||||
}) = _VeilidWASMConfigLoggingPerformance;
|
}) = _VeilidWASMConfigLoggingPerformance;
|
||||||
|
|
||||||
factory VeilidWASMConfigLoggingPerformance.fromJson(
|
factory VeilidWASMConfigLoggingPerformance.fromJson(
|
||||||
Map<String, Object?> json) =>
|
Map<String, dynamic> json) =>
|
||||||
_$VeilidWASMConfigLoggingPerformanceFromJson(json);
|
_$VeilidWASMConfigLoggingPerformanceFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class VeilidWASMConfigLoggingApi with _$VeilidWASMConfigLoggingApi {
|
|||||||
required VeilidConfigLogLevel level,
|
required VeilidConfigLogLevel level,
|
||||||
}) = _VeilidWASMConfigLoggingApi;
|
}) = _VeilidWASMConfigLoggingApi;
|
||||||
|
|
||||||
factory VeilidWASMConfigLoggingApi.fromJson(Map<String, Object?> json) =>
|
factory VeilidWASMConfigLoggingApi.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidWASMConfigLoggingApiFromJson(json);
|
_$VeilidWASMConfigLoggingApiFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class VeilidWASMConfigLogging with _$VeilidWASMConfigLogging {
|
|||||||
{required VeilidWASMConfigLoggingPerformance performance,
|
{required VeilidWASMConfigLoggingPerformance performance,
|
||||||
required VeilidWASMConfigLoggingApi api}) = _VeilidWASMConfigLogging;
|
required VeilidWASMConfigLoggingApi api}) = _VeilidWASMConfigLogging;
|
||||||
|
|
||||||
factory VeilidWASMConfigLogging.fromJson(Map<String, Object?> json) =>
|
factory VeilidWASMConfigLogging.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidWASMConfigLoggingFromJson(json);
|
_$VeilidWASMConfigLoggingFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class VeilidWASMConfig with _$VeilidWASMConfig {
|
|||||||
required VeilidWASMConfigLogging logging,
|
required VeilidWASMConfigLogging logging,
|
||||||
}) = _VeilidWASMConfig;
|
}) = _VeilidWASMConfig;
|
||||||
|
|
||||||
factory VeilidWASMConfig.fromJson(Map<String, Object?> json) =>
|
factory VeilidWASMConfig.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidWASMConfigFromJson(json);
|
_$VeilidWASMConfigFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class VeilidConfigHTTPS with _$VeilidConfigHTTPS {
|
|||||||
String? url,
|
String? url,
|
||||||
}) = _VeilidConfigHTTPS;
|
}) = _VeilidConfigHTTPS;
|
||||||
|
|
||||||
factory VeilidConfigHTTPS.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigHTTPS.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigHTTPSFromJson(json);
|
_$VeilidConfigHTTPSFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ class VeilidConfigHTTP with _$VeilidConfigHTTP {
|
|||||||
String? url,
|
String? url,
|
||||||
}) = _VeilidConfigHTTP;
|
}) = _VeilidConfigHTTP;
|
||||||
|
|
||||||
factory VeilidConfigHTTP.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigHTTP.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigHTTPFromJson(json);
|
_$VeilidConfigHTTPFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class VeilidConfigApplication with _$VeilidConfigApplication {
|
|||||||
required VeilidConfigHTTP http,
|
required VeilidConfigHTTP http,
|
||||||
}) = _VeilidConfigApplication;
|
}) = _VeilidConfigApplication;
|
||||||
|
|
||||||
factory VeilidConfigApplication.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigApplication.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigApplicationFromJson(json);
|
_$VeilidConfigApplicationFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ class VeilidConfigUDP with _$VeilidConfigUDP {
|
|||||||
required String listenAddress,
|
required String listenAddress,
|
||||||
String? publicAddress}) = _VeilidConfigUDP;
|
String? publicAddress}) = _VeilidConfigUDP;
|
||||||
|
|
||||||
factory VeilidConfigUDP.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigUDP.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigUDPFromJson(json);
|
_$VeilidConfigUDPFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ class VeilidConfigTCP with _$VeilidConfigTCP {
|
|||||||
required String listenAddress,
|
required String listenAddress,
|
||||||
String? publicAddress}) = _VeilidConfigTCP;
|
String? publicAddress}) = _VeilidConfigTCP;
|
||||||
|
|
||||||
factory VeilidConfigTCP.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigTCP.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigTCPFromJson(json);
|
_$VeilidConfigTCPFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ class VeilidConfigWS with _$VeilidConfigWS {
|
|||||||
required String path,
|
required String path,
|
||||||
String? url}) = _VeilidConfigWS;
|
String? url}) = _VeilidConfigWS;
|
||||||
|
|
||||||
factory VeilidConfigWS.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigWS.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigWSFromJson(json);
|
_$VeilidConfigWSFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ class VeilidConfigWSS with _$VeilidConfigWSS {
|
|||||||
required String path,
|
required String path,
|
||||||
String? url}) = _VeilidConfigWSS;
|
String? url}) = _VeilidConfigWSS;
|
||||||
|
|
||||||
factory VeilidConfigWSS.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigWSS.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigWSSFromJson(json);
|
_$VeilidConfigWSSFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ class VeilidConfigProtocol with _$VeilidConfigProtocol {
|
|||||||
required VeilidConfigWSS wss,
|
required VeilidConfigWSS wss,
|
||||||
}) = _VeilidConfigProtocol;
|
}) = _VeilidConfigProtocol;
|
||||||
|
|
||||||
factory VeilidConfigProtocol.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigProtocol.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigProtocolFromJson(json);
|
_$VeilidConfigProtocolFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class VeilidConfigTLS with _$VeilidConfigTLS {
|
|||||||
required int connectionInitialTimeoutMs,
|
required int connectionInitialTimeoutMs,
|
||||||
}) = _VeilidConfigTLS;
|
}) = _VeilidConfigTLS;
|
||||||
|
|
||||||
factory VeilidConfigTLS.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigTLS.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigTLSFromJson(json);
|
_$VeilidConfigTLSFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class VeilidConfigDHT with _$VeilidConfigDHT {
|
|||||||
required int remoteMaxSubkeyCacheMemoryMb,
|
required int remoteMaxSubkeyCacheMemoryMb,
|
||||||
required int remoteMaxStorageSpaceMb}) = _VeilidConfigDHT;
|
required int remoteMaxStorageSpaceMb}) = _VeilidConfigDHT;
|
||||||
|
|
||||||
factory VeilidConfigDHT.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigDHT.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigDHTFromJson(json);
|
_$VeilidConfigDHTFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ class VeilidConfigRPC with _$VeilidConfigRPC {
|
|||||||
required int maxRouteHopCount,
|
required int maxRouteHopCount,
|
||||||
required int defaultRouteHopCount}) = _VeilidConfigRPC;
|
required int defaultRouteHopCount}) = _VeilidConfigRPC;
|
||||||
|
|
||||||
factory VeilidConfigRPC.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigRPC.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigRPCFromJson(json);
|
_$VeilidConfigRPCFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ class VeilidConfigRoutingTable with _$VeilidConfigRoutingTable {
|
|||||||
required int limitAttachedWeak,
|
required int limitAttachedWeak,
|
||||||
}) = _VeilidConfigRoutingTable;
|
}) = _VeilidConfigRoutingTable;
|
||||||
|
|
||||||
factory VeilidConfigRoutingTable.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigRoutingTable.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigRoutingTableFromJson(json);
|
_$VeilidConfigRoutingTableFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ class VeilidConfigNetwork with _$VeilidConfigNetwork {
|
|||||||
required VeilidConfigProtocol protocol,
|
required VeilidConfigProtocol protocol,
|
||||||
}) = _VeilidConfigNetwork;
|
}) = _VeilidConfigNetwork;
|
||||||
|
|
||||||
factory VeilidConfigNetwork.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigNetwork.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigNetworkFromJson(json);
|
_$VeilidConfigNetworkFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ class VeilidConfigTableStore with _$VeilidConfigTableStore {
|
|||||||
required bool delete,
|
required bool delete,
|
||||||
}) = _VeilidConfigTableStore;
|
}) = _VeilidConfigTableStore;
|
||||||
|
|
||||||
factory VeilidConfigTableStore.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigTableStore.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigTableStoreFromJson(json);
|
_$VeilidConfigTableStoreFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ class VeilidConfigBlockStore with _$VeilidConfigBlockStore {
|
|||||||
required bool delete,
|
required bool delete,
|
||||||
}) = _VeilidConfigBlockStore;
|
}) = _VeilidConfigBlockStore;
|
||||||
|
|
||||||
factory VeilidConfigBlockStore.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigBlockStore.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigBlockStoreFromJson(json);
|
_$VeilidConfigBlockStoreFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ class VeilidConfigProtectedStore with _$VeilidConfigProtectedStore {
|
|||||||
required String deviceEncryptionKeyPassword,
|
required String deviceEncryptionKeyPassword,
|
||||||
String? newDeviceEncryptionKeyPassword}) = _VeilidConfigProtectedStore;
|
String? newDeviceEncryptionKeyPassword}) = _VeilidConfigProtectedStore;
|
||||||
|
|
||||||
factory VeilidConfigProtectedStore.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigProtectedStore.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigProtectedStoreFromJson(json);
|
_$VeilidConfigProtectedStoreFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ class VeilidConfigCapabilities with _$VeilidConfigCapabilities {
|
|||||||
required List<String> disable,
|
required List<String> disable,
|
||||||
}) = _VeilidConfigCapabilities;
|
}) = _VeilidConfigCapabilities;
|
||||||
|
|
||||||
factory VeilidConfigCapabilities.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfigCapabilities.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigCapabilitiesFromJson(json);
|
_$VeilidConfigCapabilitiesFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +427,6 @@ class VeilidConfig with _$VeilidConfig {
|
|||||||
required VeilidConfigNetwork network,
|
required VeilidConfigNetwork network,
|
||||||
}) = _VeilidConfig;
|
}) = _VeilidConfig;
|
||||||
|
|
||||||
factory VeilidConfig.fromJson(Map<String, Object?> json) =>
|
factory VeilidConfig.fromJson(Map<String, dynamic> json) =>
|
||||||
_$VeilidConfigFromJson(json);
|
_$VeilidConfigFromJson(json);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,15 @@ Uint8List base64UrlNoPadDecodeDynamic(dynamic source) {
|
|||||||
return base64.decode(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
|
@immutable
|
||||||
abstract class EncodedString extends Equatable {
|
abstract class EncodedString extends Equatable {
|
||||||
final String contents;
|
final String contents;
|
||||||
|
@ -367,7 +367,7 @@ Future<T> processFuturePlain<T>(Future<dynamic> future) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<T> processFutureJson<T>(
|
Future<T> processFutureJson<T>(
|
||||||
T Function(dynamic) jsonConstructor, Future<dynamic> future) {
|
T Function(Map<String, dynamic>) jsonConstructor, Future<dynamic> future) {
|
||||||
return future.then((value) {
|
return future.then((value) {
|
||||||
final list = value as List<dynamic>;
|
final list = value as List<dynamic>;
|
||||||
switch (list[0] as int) {
|
switch (list[0] as int) {
|
||||||
|
@ -52,7 +52,7 @@ class LatencyStats with _$LatencyStats {
|
|||||||
required TimestampDuration slowest,
|
required TimestampDuration slowest,
|
||||||
}) = _LatencyStats;
|
}) = _LatencyStats;
|
||||||
|
|
||||||
factory LatencyStats.fromJson(Map<String, Object?> json) =>
|
factory LatencyStats.fromJson(Map<String, dynamic> json) =>
|
||||||
_$LatencyStatsFromJson(json);
|
_$LatencyStatsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class TransferStats with _$TransferStats {
|
|||||||
required BigInt minimum,
|
required BigInt minimum,
|
||||||
}) = _TransferStats;
|
}) = _TransferStats;
|
||||||
|
|
||||||
factory TransferStats.fromJson(Map<String, Object?> json) =>
|
factory TransferStats.fromJson(Map<String, dynamic> json) =>
|
||||||
_$TransferStatsFromJson(json);
|
_$TransferStatsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class TransferStatsDownUp with _$TransferStatsDownUp {
|
|||||||
required TransferStats up,
|
required TransferStats up,
|
||||||
}) = _TransferStatsDownUp;
|
}) = _TransferStatsDownUp;
|
||||||
|
|
||||||
factory TransferStatsDownUp.fromJson(Map<String, Object?> json) =>
|
factory TransferStatsDownUp.fromJson(Map<String, dynamic> json) =>
|
||||||
_$TransferStatsDownUpFromJson(json);
|
_$TransferStatsDownUpFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ class RPCStats with _$RPCStats {
|
|||||||
required int failedToSend,
|
required int failedToSend,
|
||||||
}) = _RPCStats;
|
}) = _RPCStats;
|
||||||
|
|
||||||
factory RPCStats.fromJson(Map<String, Object?> json) =>
|
factory RPCStats.fromJson(Map<String, dynamic> json) =>
|
||||||
_$RPCStatsFromJson(json);
|
_$RPCStatsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class PeerStats with _$PeerStats {
|
|||||||
required TransferStatsDownUp transfer,
|
required TransferStatsDownUp transfer,
|
||||||
}) = _PeerStats;
|
}) = _PeerStats;
|
||||||
|
|
||||||
factory PeerStats.fromJson(Map<String, Object?> json) =>
|
factory PeerStats.fromJson(Map<String, dynamic> json) =>
|
||||||
_$PeerStatsFromJson(json);
|
_$PeerStatsFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,314 +128,109 @@ class PeerTableData with _$PeerTableData {
|
|||||||
required PeerStats peerStats,
|
required PeerStats peerStats,
|
||||||
}) = _PeerTableData;
|
}) = _PeerTableData;
|
||||||
|
|
||||||
factory PeerTableData.fromJson(Map<String, Object?> json) =>
|
factory PeerTableData.fromJson(Map<String, dynamic> json) =>
|
||||||
_$PeerTableDataFromJson(json);
|
_$PeerTableDataFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidUpdate
|
/// VeilidUpdate
|
||||||
|
|
||||||
abstract class VeilidUpdate {
|
@Freezed(unionKey: 'kind', unionValueCase: FreezedUnionCase.pascal)
|
||||||
factory VeilidUpdate.fromJson(dynamic json) {
|
sealed class VeilidUpdate with _$VeilidUpdate {
|
||||||
switch (json["kind"]) {
|
const factory VeilidUpdate.log({
|
||||||
case "Log":
|
required VeilidLogLevel logLevel,
|
||||||
{
|
required String message,
|
||||||
return VeilidLog(
|
String? backtrace,
|
||||||
logLevel: VeilidLogLevel.fromJson(json["log_level"]),
|
}) = VeilidLog;
|
||||||
message: json["message"],
|
const factory VeilidUpdate.appMessage({
|
||||||
backtrace: json["backtrace"]);
|
TypedKey? sender,
|
||||||
}
|
@Uint8ListJsonConverter() required Uint8List message,
|
||||||
case "AppMessage":
|
}) = VeilidAppMessage;
|
||||||
{
|
const factory VeilidUpdate.appCall({
|
||||||
return VeilidAppMessage(
|
TypedKey? sender,
|
||||||
sender: json["sender"], message: json["message"]);
|
@Uint8ListJsonConverter() required Uint8List message,
|
||||||
}
|
required String callId,
|
||||||
case "AppCall":
|
}) = VeilidAppCall;
|
||||||
{
|
const factory VeilidUpdate.attachment(
|
||||||
return VeilidAppCall(
|
{required AttachmentState state,
|
||||||
sender: json["sender"],
|
required bool publicInternetReady,
|
||||||
message: json["message"],
|
required bool localNetworkReady}) = VeilidUpdateAttachment;
|
||||||
callId: json["call_id"]);
|
const factory VeilidUpdate.network(
|
||||||
}
|
{required bool started,
|
||||||
case "Attachment":
|
required BigInt bpsDown,
|
||||||
{
|
required BigInt bpsUp,
|
||||||
return VeilidUpdateAttachment(
|
required List<PeerTableData> peers}) = VeilidUpdateNetwork;
|
||||||
state: VeilidStateAttachment.fromJson(json));
|
const factory VeilidUpdate.config({
|
||||||
}
|
required VeilidConfig config,
|
||||||
case "Network":
|
}) = VeilidUpdateConfig;
|
||||||
{
|
const factory VeilidUpdate.routeChange({
|
||||||
return VeilidUpdateNetwork(state: VeilidStateNetwork.fromJson(json));
|
required List<String> deadRoutes,
|
||||||
}
|
required List<String> deadRemoteRoutes,
|
||||||
case "Config":
|
}) = VeilidUpdateRouteChange;
|
||||||
{
|
const factory VeilidUpdate.valueChange({
|
||||||
return VeilidUpdateConfig(state: VeilidStateConfig.fromJson(json));
|
required TypedKey key,
|
||||||
}
|
required List<ValueSubkeyRange> subkeys,
|
||||||
case "RouteChange":
|
required int count,
|
||||||
{
|
required ValueData valueData,
|
||||||
return VeilidUpdateRouteChange(
|
}) = VeilidUpdateValueChange;
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
class VeilidLog implements VeilidUpdate {
|
factory VeilidUpdate.fromJson(Map<String, dynamic> json) =>
|
||||||
final VeilidLogLevel logLevel;
|
_$VeilidUpdateFromJson(json);
|
||||||
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(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidStateAttachment
|
/// VeilidStateAttachment
|
||||||
|
|
||||||
class VeilidStateAttachment {
|
@freezed
|
||||||
final AttachmentState state;
|
class VeilidStateAttachment with _$VeilidStateAttachment {
|
||||||
final bool publicInternetReady;
|
const factory VeilidStateAttachment(
|
||||||
final bool localNetworkReady;
|
{required AttachmentState state,
|
||||||
|
required bool publicInternetReady,
|
||||||
|
required bool localNetworkReady}) = _VeilidStateAttachment;
|
||||||
|
|
||||||
VeilidStateAttachment(
|
factory VeilidStateAttachment.fromJson(Map<String, dynamic> json) =>
|
||||||
this.state, this.publicInternetReady, this.localNetworkReady);
|
_$VeilidStateAttachmentFromJson(json);
|
||||||
|
|
||||||
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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidStateNetwork
|
/// VeilidStateNetwork
|
||||||
|
|
||||||
class VeilidStateNetwork {
|
@freezed
|
||||||
final bool started;
|
class VeilidStateNetwork with _$VeilidStateNetwork {
|
||||||
final BigInt bpsDown;
|
const factory VeilidStateNetwork(
|
||||||
final BigInt bpsUp;
|
{required bool started,
|
||||||
final List<PeerTableData> peers;
|
required BigInt bpsDown,
|
||||||
|
required BigInt bpsUp,
|
||||||
|
required List<PeerTableData> peers}) = _VeilidStateNetwork;
|
||||||
|
|
||||||
VeilidStateNetwork(
|
factory VeilidStateNetwork.fromJson(Map<String, dynamic> json) =>
|
||||||
{required this.started,
|
_$VeilidStateNetworkFromJson(json);
|
||||||
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(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidStateConfig
|
/// VeilidStateConfig
|
||||||
|
|
||||||
class VeilidStateConfig {
|
@freezed
|
||||||
final VeilidConfig config;
|
class VeilidStateConfig with _$VeilidStateConfig {
|
||||||
|
const factory VeilidStateConfig({
|
||||||
|
required VeilidConfig config,
|
||||||
|
}) = _VeilidStateConfig;
|
||||||
|
|
||||||
VeilidStateConfig({
|
factory VeilidStateConfig.fromJson(Map<String, dynamic> json) =>
|
||||||
required this.config,
|
_$VeilidStateConfigFromJson(json);
|
||||||
});
|
|
||||||
|
|
||||||
VeilidStateConfig.fromJson(dynamic json)
|
|
||||||
: config = VeilidConfig.fromJson(json['config']);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {'config': config.toJson()};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
/// VeilidState
|
/// VeilidState
|
||||||
|
|
||||||
class VeilidState {
|
@freezed
|
||||||
final VeilidStateAttachment attachment;
|
class VeilidState with _$VeilidState {
|
||||||
final VeilidStateNetwork network;
|
const factory VeilidState({
|
||||||
final VeilidStateConfig config;
|
required VeilidStateAttachment attachment,
|
||||||
|
required VeilidStateNetwork network,
|
||||||
|
required VeilidStateConfig config,
|
||||||
|
}) = _VeilidState;
|
||||||
|
|
||||||
VeilidState.fromJson(dynamic json)
|
factory VeilidState.fromJson(Map<String, dynamic> json) =>
|
||||||
: attachment = VeilidStateAttachment.fromJson(json['attachment']),
|
_$VeilidStateFromJson(json);
|
||||||
network = VeilidStateNetwork.fromJson(json['network']),
|
|
||||||
config = VeilidStateConfig.fromJson(json['config']);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return {
|
|
||||||
'attachment': attachment.toJson(),
|
|
||||||
'network': network.toJson(),
|
|
||||||
'config': config.toJson()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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_address': instance.peerAddress,
|
||||||
'peer_stats': instance.peerStats.toJson(),
|
'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