diff --git a/lib/modules/browse/extension/widgets/source_preference_widget.dart b/lib/modules/browse/extension/widgets/source_preference_widget.dart index 9b106844..733604f3 100644 --- a/lib/modules/browse/extension/widgets/source_preference_widget.dart +++ b/lib/modules/browse/extension/widgets/source_preference_widget.dart @@ -91,7 +91,13 @@ class _SourcePreferenceWidgetState extends State { final res = await showDialog( context: context, builder: (context) => AlertDialog( - title: Text(pref.title!), + title: Text.rich(TextSpan(children: [ + TextSpan(text: pref.title!), + if (pref.summary?.isNotEmpty ?? false) + TextSpan( + text: "\n\n${pref.summary!}", + style: TextStyle(fontSize: 13)) + ])), content: SizedBox( width: context.width(0.8), child: ListView.builder( diff --git a/lib/modules/more/data_and_storage/providers/auto_backup.g.dart b/lib/modules/more/data_and_storage/providers/auto_backup.g.dart index ed4d95b2..02405fad 100644 --- a/lib/modules/more/data_and_storage/providers/auto_backup.g.dart +++ b/lib/modules/more/data_and_storage/providers/auto_backup.g.dart @@ -41,7 +41,7 @@ final backupFrequencyStateProvider = typedef _$BackupFrequencyState = AutoDisposeNotifier; String _$backupFrequencyOptionsStateHash() => - r'79d93411a02867c8882d2d0f2143f5da6c107075'; + r'dd5aa850bc250e584973496fee05214b22eed9b1'; /// See also [BackupFrequencyOptionsState]. @ProviderFor(BackupFrequencyOptionsState) diff --git a/lib/modules/more/data_and_storage/providers/backup.g.dart b/lib/modules/more/data_and_storage/providers/backup.g.dart index aad8a8f6..1e5352d5 100644 --- a/lib/modules/more/data_and_storage/providers/backup.g.dart +++ b/lib/modules/more/data_and_storage/providers/backup.g.dart @@ -6,7 +6,7 @@ part of 'backup.dart'; // RiverpodGenerator // ************************************************************************** -String _$doBackUpHash() => r'71a9a1aca68f00d68fba134084edc82b7ec614db'; +String _$doBackUpHash() => r'ad907e7ff4cd9f05bb3fa2da0fd1a1f1d2c23258'; /// Copied from Dart SDK class _SystemHash { diff --git a/lib/modules/more/data_and_storage/providers/restore.g.dart b/lib/modules/more/data_and_storage/providers/restore.g.dart index 648df8e8..072a4cd0 100644 --- a/lib/modules/more/data_and_storage/providers/restore.g.dart +++ b/lib/modules/more/data_and_storage/providers/restore.g.dart @@ -173,7 +173,7 @@ class _DoRestoreProviderElement extends AutoDisposeProviderElement BuildContext get context => (origin as DoRestoreProvider).context; } -String _$restoreBackupHash() => r'8f55a7fa09ef293d558bf336e282ca1f4f44b8d4'; +String _$restoreBackupHash() => r'726b88cc165ac6cae83a2bbbb5d8b5533c3a1f46'; /// See also [restoreBackup]. @ProviderFor(restoreBackup) diff --git a/lib/modules/more/data_and_storage/providers/storage_usage.g.dart b/lib/modules/more/data_and_storage/providers/storage_usage.g.dart index fc12aad4..bf7cbda7 100644 --- a/lib/modules/more/data_and_storage/providers/storage_usage.g.dart +++ b/lib/modules/more/data_and_storage/providers/storage_usage.g.dart @@ -7,7 +7,7 @@ part of 'storage_usage.dart'; // ************************************************************************** String _$totalChapterCacheSizeStateHash() => - r'798b873b0be804a09e0dfc4049e8f60a41f1a8e8'; + r'83bf78de5ef674d61d3a9311061ef0933e59109b'; /// See also [TotalChapterCacheSizeState]. @ProviderFor(TotalChapterCacheSizeState) diff --git a/lib/services/http/m_client.dart b/lib/services/http/m_client.dart index 47d9d97f..d378fcef 100644 --- a/lib/services/http/m_client.dart +++ b/lib/services/http/m_client.dart @@ -9,6 +9,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart' as flutter_inappwebview; import 'package:mangayomi/models/settings.dart'; import 'package:http/io_client.dart'; +import 'package:mangayomi/services/http/rhttp/src/model/settings.dart'; import 'package:mangayomi/utils/log/log.dart'; import 'package:mangayomi/services/http/rhttp/rhttp.dart' as rhttp; @@ -26,9 +27,10 @@ class MClient { timeout: reqcopyWith?["timeout"] != null ? Duration(seconds: reqcopyWith?["timeout"]) : null, - connectTimeout: reqcopyWith?["connectTimeout"] != null - ? Duration(seconds: reqcopyWith?["connectTimeout"]) - : null, + timeoutSettings: TimeoutSettings( + connectTimeout: reqcopyWith?["connectTimeout"] != null + ? Duration(seconds: reqcopyWith?["connectTimeout"]) + : null), tlsSettings: rhttp.TlsSettings( verifyCertificates: reqcopyWith?["verifyCertificates"] ?? false)); diff --git a/lib/services/http/rhttp/src/model/settings.dart b/lib/services/http/rhttp/src/model/settings.dart index 85a504c6..ab841c43 100644 --- a/lib/services/http/rhttp/src/model/settings.dart +++ b/lib/services/http/rhttp/src/model/settings.dart @@ -7,7 +7,9 @@ const _keepBaseUrl = '__rhttp_keep__'; const _keepDuration = Duration(microseconds: -9999); const _keepProxySettings = ProxySettings.noProxy(); const _keepRedirectSettings = RedirectSettings.limited(-9999); +const _keepDnsSettings = DnsSettings.static(); const _keepTlsSettings = TlsSettings(); +const _keepTimeoutSettings = TimeoutSettings(); class ClientSettings { /// Base URL to be prefixed to all requests. @@ -16,9 +18,8 @@ class ClientSettings { /// The timeout for the request including time to establish a connection. final Duration? timeout; - /// The timeout for establishing a connection. - /// See [timeout] for the total timeout. - final Duration? connectTimeout; + /// Timeout and keep alive settings. + final TimeoutSettings? timeoutSettings; /// Throws an exception if the status code is 4xx or 5xx. final bool throwOnStatusCode; @@ -34,31 +35,36 @@ class ClientSettings { /// TLS settings. final TlsSettings? tlsSettings; + /// DNS settings and resolver overrides. + final DnsSettings? dnsSettings; + const ClientSettings({ this.baseUrl, this.timeout, - this.connectTimeout, + this.timeoutSettings, this.throwOnStatusCode = true, this.proxySettings, this.redirectSettings, this.tlsSettings, + this.dnsSettings, }); ClientSettings copyWith({ String? baseUrl = _keepBaseUrl, Duration? timeout = _keepDuration, - Duration? connectTimeout = _keepDuration, + TimeoutSettings? timeoutSettings = _keepTimeoutSettings, bool? throwOnStatusCode, ProxySettings? proxySettings = _keepProxySettings, RedirectSettings? redirectSettings = _keepRedirectSettings, TlsSettings? tlsSettings = _keepTlsSettings, + DnsSettings? dnsSettings = _keepDnsSettings, }) { return ClientSettings( baseUrl: identical(baseUrl, _keepBaseUrl) ? this.baseUrl : baseUrl, timeout: identical(timeout, _keepDuration) ? this.timeout : timeout, - connectTimeout: identical(connectTimeout, _keepDuration) - ? this.connectTimeout - : connectTimeout, + timeoutSettings: identical(timeoutSettings, _keepTimeoutSettings) + ? this.timeoutSettings + : timeoutSettings, throwOnStatusCode: throwOnStatusCode ?? this.throwOnStatusCode, proxySettings: identical(proxySettings, _keepProxySettings) ? this.proxySettings @@ -69,6 +75,9 @@ class ClientSettings { tlsSettings: identical(tlsSettings, _keepTlsSettings) ? this.tlsSettings : tlsSettings, + dnsSettings: identical(dnsSettings, _keepDnsSettings) + ? this.dnsSettings + : dnsSettings, ); } } @@ -158,15 +167,149 @@ class ClientCertificate { }); } +sealed class CustomProxy extends ProxySettings { + const CustomProxy._(); +} + +class StaticProxy extends CustomProxy { + /// The URL of the proxy server. + final String url; + + /// Which requests to proxy. + final ProxyCondition condition; + + const StaticProxy({ + required this.url, + required this.condition, + }) : super._(); + + const StaticProxy.http(String url) + : this( + url: url, + condition: ProxyCondition.onlyHttp, + ); + + const StaticProxy.https(String url) + : this( + url: url, + condition: ProxyCondition.onlyHttps, + ); + + const StaticProxy.all(String url) + : this( + url: url, + condition: ProxyCondition.all, + ); +} + +class CustomProxyList extends ProxySettings { + /// A list of custom proxies. + /// The first proxy that matches the request will be used. + final List proxies; + + const CustomProxyList(this.proxies); +} + +enum ProxyCondition { + /// Proxy only HTTP requests. + onlyHttp, + + /// Proxy only HTTPS requests. + onlyHttps, + + /// Proxy all requests. + all, +} + +/// General timeout settings for the client. +class TimeoutSettings { + /// The timeout for the request including time to establish a connection. + final Duration? timeout; + + /// The timeout for establishing a connection. + /// See [timeout] for the total timeout. + final Duration? connectTimeout; + + /// Keep alive idle timeout. If not set, keep alive is disabled. + final Duration? keepAliveTimeout; + + /// Keep alive ping interval. + /// Only valid if keepAliveTimeout is set and HTTP/2 is used. + final Duration keepAlivePing; + + const TimeoutSettings({ + this.timeout, + this.connectTimeout, + this.keepAliveTimeout, + this.keepAlivePing = const Duration(seconds: 30), + }); + + TimeoutSettings copyWith({ + Duration? timeout, + Duration? connectTimeout, + Duration? keepAliveTimeout, + Duration? keepAlivePing, + }) { + return TimeoutSettings( + timeout: timeout ?? this.timeout, + connectTimeout: connectTimeout ?? this.connectTimeout, + keepAliveTimeout: keepAliveTimeout ?? this.keepAliveTimeout, + keepAlivePing: keepAlivePing ?? this.keepAlivePing, + ); + } +} + +sealed class DnsSettings { + const DnsSettings(); + + /// Static DNS settings and resolver overrides + /// for simple use cases. + const factory DnsSettings.static({ + Map> overrides, + String? fallback, + }) = StaticDnsSettings._; + + /// Dynamic DNS settings and resolver for more complex use cases. + const factory DnsSettings.dynamic({ + required Future> Function(String host) resolver, + }) = DynamicDnsSettings._; +} + +/// Static DNS settings and resolver overrides. +class StaticDnsSettings extends DnsSettings { + /// Overrides the DNS resolver for specific hosts. + /// The key is the host and the value is a list of IP addresses. + final Map> overrides; + + /// If set, the client will use this IP address for + /// all requests that don't match any override. + final String? fallback; + + const StaticDnsSettings._({ + this.overrides = const {}, + this.fallback, + }); +} + +/// Dynamic DNS settings and resolver. +class DynamicDnsSettings extends DnsSettings { + /// The function to resolve the IP address for a host. + final Future> Function(String host) resolver; + + const DynamicDnsSettings._({ + required this.resolver, + }); +} + extension ClientSettingsExt on ClientSettings { rust_client.ClientSettings toRustType() { return rust_client.ClientSettings( - timeout: timeout, - connectTimeout: connectTimeout, + timeoutSettings: timeoutSettings?._toRustType(), throwOnStatusCode: throwOnStatusCode, proxySettings: proxySettings?._toRustType(), redirectSettings: redirectSettings?._toRustType(), tlsSettings: tlsSettings?._toRustType(), + dnsSettings: dnsSettings?._toRustType(), ); } } @@ -174,11 +317,43 @@ extension ClientSettingsExt on ClientSettings { extension on ProxySettings { rust_client.ProxySettings _toRustType() { return switch (this) { - NoProxy() => rust_client.ProxySettings.noProxy, + NoProxy() => const rust_client.ProxySettings.noProxy(), + CustomProxy proxy => rust_client.ProxySettings.customProxyList([ + proxy._toRustType(), + ]), + CustomProxyList list => rust_client.ProxySettings.customProxyList( + list.proxies.map((e) => e._toRustType()).toList(), + ), }; } } +extension on CustomProxy { + rust_client.CustomProxy _toRustType() { + return switch (this) { + StaticProxy s => rust_client.CustomProxy( + url: s.url, + condition: switch (s.condition) { + ProxyCondition.onlyHttp => rust_client.ProxyCondition.http, + ProxyCondition.onlyHttps => rust_client.ProxyCondition.https, + ProxyCondition.all => rust_client.ProxyCondition.all, + }, + ), + }; + } +} + +extension on TimeoutSettings { + rust_client.TimeoutSettings _toRustType() { + return rust_client.TimeoutSettings( + timeout: timeout, + connectTimeout: connectTimeout, + keepAliveTimeout: keepAliveTimeout, + keepAlivePing: keepAlivePing, + ); + } +} + extension on RedirectSettings { rust_client.RedirectSettings _toRustType() { return switch (this) { @@ -212,3 +387,19 @@ extension on ClientCertificate { ); } } + +extension on DnsSettings { + rust_client.DnsSettings _toRustType() { + return switch (this) { + StaticDnsSettings s => rust_client.createStaticResolverSync( + settings: rust_client.StaticDnsSettings( + overrides: s.overrides, + fallback: s.fallback, + ), + ), + DynamicDnsSettings d => rust_client.createDynamicResolverSync( + resolver: d.resolver, + ), + }; + } +} diff --git a/lib/src/rust/api/rhttp/client.dart b/lib/src/rust/api/rhttp/client.dart index e0b622e7..4f5ff37d 100644 --- a/lib/src/rust/api/rhttp/client.dart +++ b/lib/src/rust/api/rhttp/client.dart @@ -9,11 +9,30 @@ import 'package:freezed_annotation/freezed_annotation.dart' hide protected; part 'client.freezed.dart'; // These functions are ignored because they are not marked as `pub`: `create_client`, `new_default`, `new` -// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone` +// These types are ignored because they are not used by any `pub` functions: `DynamicDnsSettings`, `DynamicResolver`, `StaticResolver` +// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `resolve`, `resolve` +// These functions are ignored (category: IgnoreBecauseNotAllowedOwner): `digest_ip` + +DnsSettings createStaticResolverSync({required StaticDnsSettings settings}) => + RustLib.instance.api + .crateApiRhttpClientCreateStaticResolverSync(settings: settings); + +DnsSettings createDynamicResolverSync( + {required FutureOr> Function(String) resolver}) => + RustLib.instance.api + .crateApiRhttpClientCreateDynamicResolverSync(resolver: resolver); + +// Rust type: RustOpaqueMoi> +abstract class DnsSettings implements RustOpaqueInterface {} // Rust type: RustOpaqueMoi> abstract class RequestClient implements RustOpaqueInterface {} +abstract class SocketAddrDigester { + /// Adds the `FALLBACK_PORT` to the end of the string if it doesn't have a port. + Future digestIp(); +} + class ClientCertificate { final Uint8List certificate; final Uint8List privateKey; @@ -36,20 +55,20 @@ class ClientCertificate { } class ClientSettings { - final Duration? timeout; - final Duration? connectTimeout; + final TimeoutSettings? timeoutSettings; final bool throwOnStatusCode; final ProxySettings? proxySettings; final RedirectSettings? redirectSettings; final TlsSettings? tlsSettings; + final DnsSettings? dnsSettings; const ClientSettings({ - this.timeout, - this.connectTimeout, + this.timeoutSettings, required this.throwOnStatusCode, this.proxySettings, this.redirectSettings, this.tlsSettings, + this.dnsSettings, }); static Future default_() => @@ -57,31 +76,64 @@ class ClientSettings { @override int get hashCode => - timeout.hashCode ^ - connectTimeout.hashCode ^ + timeoutSettings.hashCode ^ throwOnStatusCode.hashCode ^ proxySettings.hashCode ^ redirectSettings.hashCode ^ - tlsSettings.hashCode; + tlsSettings.hashCode ^ + dnsSettings.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is ClientSettings && runtimeType == other.runtimeType && - timeout == other.timeout && - connectTimeout == other.connectTimeout && + timeoutSettings == other.timeoutSettings && throwOnStatusCode == other.throwOnStatusCode && proxySettings == other.proxySettings && redirectSettings == other.redirectSettings && - tlsSettings == other.tlsSettings; + tlsSettings == other.tlsSettings && + dnsSettings == other.dnsSettings; } -enum ProxySettings { - noProxy, +class CustomProxy { + final String url; + final ProxyCondition condition; + + const CustomProxy({ + required this.url, + required this.condition, + }); + + @override + int get hashCode => url.hashCode ^ condition.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CustomProxy && + runtimeType == other.runtimeType && + url == other.url && + condition == other.condition; +} + +enum ProxyCondition { + http, + https, + all, ; } +@freezed +sealed class ProxySettings with _$ProxySettings { + const ProxySettings._(); + + const factory ProxySettings.noProxy() = ProxySettings_NoProxy; + const factory ProxySettings.customProxyList( + List field0, + ) = ProxySettings_CustomProxyList; +} + @freezed sealed class RedirectSettings with _$RedirectSettings { const RedirectSettings._(); @@ -92,6 +144,58 @@ sealed class RedirectSettings with _$RedirectSettings { ) = RedirectSettings_LimitedRedirects; } +class StaticDnsSettings { + final Map> overrides; + final String? fallback; + + const StaticDnsSettings({ + required this.overrides, + this.fallback, + }); + + @override + int get hashCode => overrides.hashCode ^ fallback.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is StaticDnsSettings && + runtimeType == other.runtimeType && + overrides == other.overrides && + fallback == other.fallback; +} + +class TimeoutSettings { + final Duration? timeout; + final Duration? connectTimeout; + final Duration? keepAliveTimeout; + final Duration? keepAlivePing; + + const TimeoutSettings({ + this.timeout, + this.connectTimeout, + this.keepAliveTimeout, + this.keepAlivePing, + }); + + @override + int get hashCode => + timeout.hashCode ^ + connectTimeout.hashCode ^ + keepAliveTimeout.hashCode ^ + keepAlivePing.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TimeoutSettings && + runtimeType == other.runtimeType && + timeout == other.timeout && + connectTimeout == other.connectTimeout && + keepAliveTimeout == other.keepAliveTimeout && + keepAlivePing == other.keepAlivePing; +} + class TlsSettings { final bool trustRootCertificates; final List trustedRootCertificates; diff --git a/lib/src/rust/api/rhttp/client.freezed.dart b/lib/src/rust/api/rhttp/client.freezed.dart index 836134a4..930a6b78 100644 --- a/lib/src/rust/api/rhttp/client.freezed.dart +++ b/lib/src/rust/api/rhttp/client.freezed.dart @@ -14,6 +14,337 @@ T _$identity(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#adding-getters-and-methods-to-our-models'); +/// @nodoc +mixin _$ProxySettings { + @optionalTypeArgs + TResult when({ + required TResult Function() noProxy, + required TResult Function(List field0) customProxyList, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? noProxy, + TResult? Function(List field0)? customProxyList, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? noProxy, + TResult Function(List field0)? customProxyList, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult map({ + required TResult Function(ProxySettings_NoProxy value) noProxy, + required TResult Function(ProxySettings_CustomProxyList value) + customProxyList, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ProxySettings_NoProxy value)? noProxy, + TResult? Function(ProxySettings_CustomProxyList value)? customProxyList, + }) => + throw _privateConstructorUsedError; + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ProxySettings_NoProxy value)? noProxy, + TResult Function(ProxySettings_CustomProxyList value)? customProxyList, + required TResult orElse(), + }) => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProxySettingsCopyWith<$Res> { + factory $ProxySettingsCopyWith( + ProxySettings value, $Res Function(ProxySettings) then) = + _$ProxySettingsCopyWithImpl<$Res, ProxySettings>; +} + +/// @nodoc +class _$ProxySettingsCopyWithImpl<$Res, $Val extends ProxySettings> + implements $ProxySettingsCopyWith<$Res> { + _$ProxySettingsCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProxySettings + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc +abstract class _$$ProxySettings_NoProxyImplCopyWith<$Res> { + factory _$$ProxySettings_NoProxyImplCopyWith( + _$ProxySettings_NoProxyImpl value, + $Res Function(_$ProxySettings_NoProxyImpl) then) = + __$$ProxySettings_NoProxyImplCopyWithImpl<$Res>; +} + +/// @nodoc +class __$$ProxySettings_NoProxyImplCopyWithImpl<$Res> + extends _$ProxySettingsCopyWithImpl<$Res, _$ProxySettings_NoProxyImpl> + implements _$$ProxySettings_NoProxyImplCopyWith<$Res> { + __$$ProxySettings_NoProxyImplCopyWithImpl(_$ProxySettings_NoProxyImpl _value, + $Res Function(_$ProxySettings_NoProxyImpl) _then) + : super(_value, _then); + + /// Create a copy of ProxySettings + /// with the given fields replaced by the non-null parameter values. +} + +/// @nodoc + +class _$ProxySettings_NoProxyImpl extends ProxySettings_NoProxy { + const _$ProxySettings_NoProxyImpl() : super._(); + + @override + String toString() { + return 'ProxySettings.noProxy()'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProxySettings_NoProxyImpl); + } + + @override + int get hashCode => runtimeType.hashCode; + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() noProxy, + required TResult Function(List field0) customProxyList, + }) { + return noProxy(); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? noProxy, + TResult? Function(List field0)? customProxyList, + }) { + return noProxy?.call(); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? noProxy, + TResult Function(List field0)? customProxyList, + required TResult orElse(), + }) { + if (noProxy != null) { + return noProxy(); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ProxySettings_NoProxy value) noProxy, + required TResult Function(ProxySettings_CustomProxyList value) + customProxyList, + }) { + return noProxy(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ProxySettings_NoProxy value)? noProxy, + TResult? Function(ProxySettings_CustomProxyList value)? customProxyList, + }) { + return noProxy?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ProxySettings_NoProxy value)? noProxy, + TResult Function(ProxySettings_CustomProxyList value)? customProxyList, + required TResult orElse(), + }) { + if (noProxy != null) { + return noProxy(this); + } + return orElse(); + } +} + +abstract class ProxySettings_NoProxy extends ProxySettings { + const factory ProxySettings_NoProxy() = _$ProxySettings_NoProxyImpl; + const ProxySettings_NoProxy._() : super._(); +} + +/// @nodoc +abstract class _$$ProxySettings_CustomProxyListImplCopyWith<$Res> { + factory _$$ProxySettings_CustomProxyListImplCopyWith( + _$ProxySettings_CustomProxyListImpl value, + $Res Function(_$ProxySettings_CustomProxyListImpl) then) = + __$$ProxySettings_CustomProxyListImplCopyWithImpl<$Res>; + @useResult + $Res call({List field0}); +} + +/// @nodoc +class __$$ProxySettings_CustomProxyListImplCopyWithImpl<$Res> + extends _$ProxySettingsCopyWithImpl<$Res, + _$ProxySettings_CustomProxyListImpl> + implements _$$ProxySettings_CustomProxyListImplCopyWith<$Res> { + __$$ProxySettings_CustomProxyListImplCopyWithImpl( + _$ProxySettings_CustomProxyListImpl _value, + $Res Function(_$ProxySettings_CustomProxyListImpl) _then) + : super(_value, _then); + + /// Create a copy of ProxySettings + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? field0 = null, + }) { + return _then(_$ProxySettings_CustomProxyListImpl( + null == field0 + ? _value._field0 + : field0 // ignore: cast_nullable_to_non_nullable + as List, + )); + } +} + +/// @nodoc + +class _$ProxySettings_CustomProxyListImpl + extends ProxySettings_CustomProxyList { + const _$ProxySettings_CustomProxyListImpl(final List field0) + : _field0 = field0, + super._(); + + final List _field0; + @override + List get field0 { + if (_field0 is EqualUnmodifiableListView) return _field0; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_field0); + } + + @override + String toString() { + return 'ProxySettings.customProxyList(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProxySettings_CustomProxyListImpl && + const DeepCollectionEquality().equals(other._field0, _field0)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(_field0)); + + /// Create a copy of ProxySettings + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProxySettings_CustomProxyListImplCopyWith< + _$ProxySettings_CustomProxyListImpl> + get copyWith => __$$ProxySettings_CustomProxyListImplCopyWithImpl< + _$ProxySettings_CustomProxyListImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function() noProxy, + required TResult Function(List field0) customProxyList, + }) { + return customProxyList(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function()? noProxy, + TResult? Function(List field0)? customProxyList, + }) { + return customProxyList?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function()? noProxy, + TResult Function(List field0)? customProxyList, + required TResult orElse(), + }) { + if (customProxyList != null) { + return customProxyList(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(ProxySettings_NoProxy value) noProxy, + required TResult Function(ProxySettings_CustomProxyList value) + customProxyList, + }) { + return customProxyList(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(ProxySettings_NoProxy value)? noProxy, + TResult? Function(ProxySettings_CustomProxyList value)? customProxyList, + }) { + return customProxyList?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(ProxySettings_NoProxy value)? noProxy, + TResult Function(ProxySettings_CustomProxyList value)? customProxyList, + required TResult orElse(), + }) { + if (customProxyList != null) { + return customProxyList(this); + } + return orElse(); + } +} + +abstract class ProxySettings_CustomProxyList extends ProxySettings { + const factory ProxySettings_CustomProxyList(final List field0) = + _$ProxySettings_CustomProxyListImpl; + const ProxySettings_CustomProxyList._() : super._(); + + List get field0; + + /// Create a copy of ProxySettings + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProxySettings_CustomProxyListImplCopyWith< + _$ProxySettings_CustomProxyListImpl> + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc mixin _$RedirectSettings { @optionalTypeArgs diff --git a/lib/src/rust/frb_generated.dart b/lib/src/rust/frb_generated.dart index 9cd67c6e..82c0d7f1 100644 --- a/lib/src/rust/frb_generated.dart +++ b/lib/src/rust/frb_generated.dart @@ -70,7 +70,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.7.0'; @override - int get rustContentHash => 107666026; + int get rustContentHash => 885218533; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( @@ -89,6 +89,12 @@ abstract class RustLibApi extends BaseApi { Future crateApiRhttpClientClientSettingsDefault(); + DnsSettings crateApiRhttpClientCreateDynamicResolverSync( + {required FutureOr> Function(String) resolver}); + + DnsSettings crateApiRhttpClientCreateStaticResolverSync( + {required StaticDnsSettings settings}); + Stream crateApiRhttpHttpMakeHttpRequestReceiveStream( {RequestClient? client, ClientSettings? settings, @@ -119,6 +125,14 @@ abstract class RustLibApi extends BaseApi { CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_CancellationTokenPtr; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_DnsSettings; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_DnsSettings; + + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_DnsSettingsPtr; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_RequestClient; @@ -146,7 +160,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( token, serializer); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 1, port: port_); + funcId: 2, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, @@ -173,7 +187,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( client, serializer); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 2, port: port_); + funcId: 3, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, @@ -197,7 +211,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: (port_) { final serializer = SseSerializer(generalizedFrbRustBinding); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 3, port: port_); + funcId: 4, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_client_settings, @@ -215,6 +229,59 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: [], ); + @override + DnsSettings crateApiRhttpClientCreateDynamicResolverSync( + {required FutureOr> Function(String) resolver}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException( + resolver, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 5)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings, + decodeErrorData: null, + ), + constMeta: kCrateApiRhttpClientCreateDynamicResolverSyncConstMeta, + argValues: [resolver], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiRhttpClientCreateDynamicResolverSyncConstMeta => + const TaskConstMeta( + debugName: "create_dynamic_resolver_sync", + argNames: ["resolver"], + ); + + @override + DnsSettings crateApiRhttpClientCreateStaticResolverSync( + {required StaticDnsSettings settings}) { + return handler.executeSync(SyncTask( + callFfi: () { + final serializer = SseSerializer(generalizedFrbRustBinding); + sse_encode_box_autoadd_static_dns_settings(settings, serializer); + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 6)!; + }, + codec: SseCodec( + decodeSuccessData: + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings, + decodeErrorData: null, + ), + constMeta: kCrateApiRhttpClientCreateStaticResolverSyncConstMeta, + argValues: [settings], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateApiRhttpClientCreateStaticResolverSyncConstMeta => + const TaskConstMeta( + debugName: "create_static_resolver_sync", + argNames: ["settings"], + ); + @override Stream crateApiRhttpHttpMakeHttpRequestReceiveStream( {RequestClient? client, @@ -249,7 +316,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { onCancelToken, serializer); sse_encode_bool(cancelable, serializer); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 4, port: port_); + funcId: 7, port: port_); }, codec: SseCodec( decodeSuccessData: sse_decode_unit, @@ -300,7 +367,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_list_prim_u_8_loose(image, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 5)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 8)!; }, codec: SseCodec( decodeSuccessData: sse_decode_list_prim_u_8_strict, @@ -326,7 +393,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_box_autoadd_client_settings(settings, serializer); pdeCallFfi(generalizedFrbRustBinding, serializer, - funcId: 6, port: port_); + funcId: 9, port: port_); }, codec: SseCodec( decodeSuccessData: @@ -352,7 +419,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { callFfi: () { final serializer = SseSerializer(generalizedFrbRustBinding); sse_encode_box_autoadd_client_settings(settings, serializer); - return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 7)!; + return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 10)!; }, codec: SseCodec( decodeSuccessData: @@ -406,6 +473,39 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { }; } + Future Function(int, dynamic) + encode_DartFn_Inputs_String_Output_list_String_AnyhowException( + FutureOr> Function(String) raw) { + return (callId, rawArg0) async { + final arg0 = dco_decode_String(rawArg0); + + Box>? rawOutput; + Box? rawError; + try { + rawOutput = Box(await raw(arg0)); + } catch (e, s) { + rawError = Box(AnyhowException("$e\n\n$s")); + } + + final serializer = SseSerializer(generalizedFrbRustBinding); + assert((rawOutput != null) ^ (rawError != null)); + if (rawOutput != null) { + serializer.buffer.putUint8(0); + sse_encode_list_String(rawOutput.value, serializer); + } else { + serializer.buffer.putUint8(1); + sse_encode_AnyhowException(rawError!.value, serializer); + } + final output = serializer.intoRaw(); + + generalizedFrbRustBinding.dartFnDeliverOutput( + callId: callId, + ptr: output.ptr, + rustVecLen: output.rustVecLen, + dataLen: output.dataLen); + }; + } + Future Function(int, dynamic) encode_DartFn_Inputs_http_response_Output_unit_AnyhowException( FutureOr Function(HttpResponse) raw) { @@ -480,6 +580,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { get rust_arc_decrement_strong_count_CancellationToken => wire .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken; + RustArcIncrementStrongCountFnType + get rust_arc_increment_strong_count_DnsSettings => wire + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings; + + RustArcDecrementStrongCountFnType + get rust_arc_decrement_strong_count_DnsSettings => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings; + RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_RequestClient => wire .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient; @@ -511,6 +619,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return CancellationTokenImpl.frbInternalDcoDecode(raw as List); } + @protected + DnsSettings + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return DnsSettingsImpl.frbInternalDcoDecode(raw as List); + } + @protected RequestClient dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -549,6 +665,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { throw UnimplementedError(''); } + @protected + FutureOr> Function(String) + dco_decode_DartFn_Inputs_String_Output_list_String_AnyhowException( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(''); + } + @protected FutureOr Function(HttpResponse) dco_decode_DartFn_Inputs_http_response_Output_unit_AnyhowException( @@ -578,6 +702,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { .map((e) => MapEntry(e.$1, e.$2))); } + @protected + Map> dco_decode_Map_String_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return Map.fromEntries(dco_decode_list_record_string_list_string(raw) + .map((e) => MapEntry(e.$1, e.$2))); + } + @protected CancellationToken dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( @@ -586,6 +717,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return CancellationTokenImpl.frbInternalDcoDecode(raw as List); } + @protected + DnsSettings + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return DnsSettingsImpl.frbInternalDcoDecode(raw as List); + } + @protected RequestClient dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -607,12 +746,27 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as String; } + @protected + SocketAddrDigester dco_decode_TraitDef_SocketAddrDigester(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + throw UnimplementedError(); + } + @protected bool dco_decode_bool(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as bool; } + @protected + DnsSettings + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + raw); + } + @protected Duration dco_decode_box_autoadd_Chrono_Duration(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -655,6 +809,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_redirect_settings(raw); } + @protected + StaticDnsSettings dco_decode_box_autoadd_static_dns_settings(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_static_dns_settings(raw); + } + + @protected + TimeoutSettings dco_decode_box_autoadd_timeout_settings(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_timeout_settings(raw); + } + @protected TlsSettings dco_decode_box_autoadd_tls_settings(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -686,12 +852,26 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { if (arr.length != 6) throw Exception('unexpected arr length: expect 6 but see ${arr.length}'); return ClientSettings( - timeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[0]), - connectTimeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[1]), - throwOnStatusCode: dco_decode_bool(arr[2]), - proxySettings: dco_decode_opt_box_autoadd_proxy_settings(arr[3]), - redirectSettings: dco_decode_opt_box_autoadd_redirect_settings(arr[4]), - tlsSettings: dco_decode_opt_box_autoadd_tls_settings(arr[5]), + timeoutSettings: dco_decode_opt_box_autoadd_timeout_settings(arr[0]), + throwOnStatusCode: dco_decode_bool(arr[1]), + proxySettings: dco_decode_opt_box_autoadd_proxy_settings(arr[2]), + redirectSettings: dco_decode_opt_box_autoadd_redirect_settings(arr[3]), + tlsSettings: dco_decode_opt_box_autoadd_tls_settings(arr[4]), + dnsSettings: + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + arr[5]), + ); + } + + @protected + CustomProxy dco_decode_custom_proxy(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) + throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return CustomProxy( + url: dco_decode_String(arr[0]), + condition: dco_decode_proxy_condition(arr[1]), ); } @@ -775,6 +955,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dcoDecodeI64(raw); } + @protected + List dco_decode_list_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_String).toList(); + } + + @protected + List dco_decode_list_custom_proxy(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_custom_proxy).toList(); + } + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -793,6 +985,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as Uint8List; } + @protected + List<(String, List)> dco_decode_list_record_string_list_string( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List) + .map(dco_decode_record_string_list_string) + .toList(); + } + @protected List<(String, String)> dco_decode_list_record_string_string(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -810,6 +1011,23 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { raw); } + @protected + String? dco_decode_opt_String(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_String(raw); + } + + @protected + DnsSettings? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null + ? null + : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + raw); + } + @protected Duration? dco_decode_opt_box_autoadd_Chrono_Duration(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -847,6 +1065,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw == null ? null : dco_decode_box_autoadd_redirect_settings(raw); } + @protected + TimeoutSettings? dco_decode_opt_box_autoadd_timeout_settings(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_timeout_settings(raw); + } + @protected TlsSettings? dco_decode_opt_box_autoadd_tls_settings(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -872,10 +1096,38 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw == null ? null : dco_decode_list_record_string_string(raw); } + @protected + ProxyCondition dco_decode_proxy_condition(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return ProxyCondition.values[raw as int]; + } + @protected ProxySettings dco_decode_proxy_settings(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs - return ProxySettings.values[raw as int]; + switch (raw[0]) { + case 0: + return ProxySettings_NoProxy(); + case 1: + return ProxySettings_CustomProxyList( + dco_decode_list_custom_proxy(raw[1]), + ); + default: + throw Exception("unreachable"); + } + } + + @protected + (String, List) dco_decode_record_string_list_string(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) { + throw Exception('Expected 2 elements, got ${arr.length}'); + } + return ( + dco_decode_String(arr[0]), + dco_decode_list_String(arr[1]), + ); } @protected @@ -939,6 +1191,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + StaticDnsSettings dco_decode_static_dns_settings(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) + throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return StaticDnsSettings( + overrides: dco_decode_Map_String_list_String(arr[0]), + fallback: dco_decode_opt_String(arr[1]), + ); + } + + @protected + TimeoutSettings dco_decode_timeout_settings(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) + throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return TimeoutSettings( + timeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[0]), + connectTimeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[1]), + keepAliveTimeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[2]), + keepAlivePing: dco_decode_opt_box_autoadd_Chrono_Duration(arr[3]), + ); + } + @protected TlsSettings dco_decode_tls_settings(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1012,6 +1290,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } + @protected + DnsSettings + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return DnsSettingsImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + @protected RequestClient sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -1061,6 +1348,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2))); } + @protected + Map> sse_decode_Map_String_list_String( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var inner = sse_decode_list_record_string_list_string(deserializer); + return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2))); + } + @protected CancellationToken sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( @@ -1070,6 +1365,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); } + @protected + DnsSettings + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return DnsSettingsImpl.frbInternalSseDecode( + sse_decode_usize(deserializer), sse_decode_i_32(deserializer)); + } + @protected RequestClient sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -1099,6 +1403,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getUint8() != 0; } + @protected + DnsSettings + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + deserializer)); + } + @protected Duration sse_decode_box_autoadd_Chrono_Duration( SseDeserializer deserializer) { @@ -1148,6 +1461,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_redirect_settings(deserializer)); } + @protected + StaticDnsSettings sse_decode_box_autoadd_static_dns_settings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_static_dns_settings(deserializer)); + } + + @protected + TimeoutSettings sse_decode_box_autoadd_timeout_settings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_timeout_settings(deserializer)); + } + @protected TlsSettings sse_decode_box_autoadd_tls_settings( SseDeserializer deserializer) { @@ -1174,22 +1501,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { @protected ClientSettings sse_decode_client_settings(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs - var var_timeout = sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); - var var_connectTimeout = - sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); + var var_timeoutSettings = + sse_decode_opt_box_autoadd_timeout_settings(deserializer); var var_throwOnStatusCode = sse_decode_bool(deserializer); var var_proxySettings = sse_decode_opt_box_autoadd_proxy_settings(deserializer); var var_redirectSettings = sse_decode_opt_box_autoadd_redirect_settings(deserializer); var var_tlsSettings = sse_decode_opt_box_autoadd_tls_settings(deserializer); + var var_dnsSettings = + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + deserializer); return ClientSettings( - timeout: var_timeout, - connectTimeout: var_connectTimeout, + timeoutSettings: var_timeoutSettings, throwOnStatusCode: var_throwOnStatusCode, proxySettings: var_proxySettings, redirectSettings: var_redirectSettings, - tlsSettings: var_tlsSettings); + tlsSettings: var_tlsSettings, + dnsSettings: var_dnsSettings); + } + + @protected + CustomProxy sse_decode_custom_proxy(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_url = sse_decode_String(deserializer); + var var_condition = sse_decode_proxy_condition(deserializer); + return CustomProxy(url: var_url, condition: var_condition); } @protected @@ -1274,6 +1611,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getPlatformInt64(); } + @protected + List sse_decode_list_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_String(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_custom_proxy(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_custom_proxy(deserializer)); + } + return ans_; + } + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer) { @@ -1301,6 +1662,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getUint8List(len_); } + @protected + List<(String, List)> sse_decode_list_record_string_list_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = <(String, List)>[]; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_record_string_list_string(deserializer)); + } + return ans_; + } + @protected List<(String, String)> sse_decode_list_record_string_string( SseDeserializer deserializer) { @@ -1328,6 +1702,31 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + String? sse_decode_opt_String(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_String(deserializer)); + } else { + return null; + } + } + + @protected + DnsSettings? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + deserializer)); + } else { + return null; + } + } + @protected Duration? sse_decode_opt_box_autoadd_Chrono_Duration( SseDeserializer deserializer) { @@ -1400,6 +1799,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + TimeoutSettings? sse_decode_opt_box_autoadd_timeout_settings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_timeout_settings(deserializer)); + } else { + return null; + } + } + @protected TlsSettings? sse_decode_opt_box_autoadd_tls_settings( SseDeserializer deserializer) { @@ -1448,10 +1859,35 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } @protected - ProxySettings sse_decode_proxy_settings(SseDeserializer deserializer) { + ProxyCondition sse_decode_proxy_condition(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs var inner = sse_decode_i_32(deserializer); - return ProxySettings.values[inner]; + return ProxyCondition.values[inner]; + } + + @protected + ProxySettings sse_decode_proxy_settings(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var tag_ = sse_decode_i_32(deserializer); + switch (tag_) { + case 0: + return ProxySettings_NoProxy(); + case 1: + var var_field0 = sse_decode_list_custom_proxy(deserializer); + return ProxySettings_CustomProxyList(var_field0); + default: + throw UnimplementedError(''); + } + } + + @protected + (String, List) sse_decode_record_string_list_string( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_field0 = sse_decode_String(deserializer); + var var_field1 = sse_decode_list_String(deserializer); + return (var_field0, var_field1); } @protected @@ -1512,6 +1948,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + StaticDnsSettings sse_decode_static_dns_settings( + SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_overrides = sse_decode_Map_String_list_String(deserializer); + var var_fallback = sse_decode_opt_String(deserializer); + return StaticDnsSettings(overrides: var_overrides, fallback: var_fallback); + } + + @protected + TimeoutSettings sse_decode_timeout_settings(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_timeout = sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); + var var_connectTimeout = + sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); + var var_keepAliveTimeout = + sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); + var var_keepAlivePing = + sse_decode_opt_box_autoadd_Chrono_Duration(deserializer); + return TimeoutSettings( + timeout: var_timeout, + connectTimeout: var_connectTimeout, + keepAliveTimeout: var_keepAliveTimeout, + keepAlivePing: var_keepAlivePing); + } + @protected TlsSettings sse_decode_tls_settings(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -1590,6 +2052,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer); } + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as DnsSettingsImpl).frbInternalSseEncode(move: true), serializer); + } + @protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -1638,6 +2109,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer); } + @protected + void sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException( + FutureOr> Function(String) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_DartOpaque( + encode_DartFn_Inputs_String_Output_list_String_AnyhowException(self), + serializer); + } + @protected void sse_encode_DartFn_Inputs_http_response_Output_unit_AnyhowException( FutureOr Function(HttpResponse) self, SseSerializer serializer) { @@ -1673,6 +2153,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { self.entries.map((e) => (e.key, e.value)).toList(), serializer); } + @protected + void sse_encode_Map_String_list_String( + Map> self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_list_record_string_list_string( + self.entries.map((e) => (e.key, e.value)).toList(), serializer); + } + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( @@ -1683,6 +2171,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer); } + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_usize( + (self as DnsSettingsImpl).frbInternalSseEncode(move: null), serializer); + } + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -1718,6 +2215,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putUint8(self ? 1 : 0); } + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + self, serializer); + } + @protected void sse_encode_box_autoadd_Chrono_Duration( Duration self, SseSerializer serializer) { @@ -1767,6 +2273,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_redirect_settings(self, serializer); } + @protected + void sse_encode_box_autoadd_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_static_dns_settings(self, serializer); + } + + @protected + void sse_encode_box_autoadd_timeout_settings( + TimeoutSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_timeout_settings(self, serializer); + } + @protected void sse_encode_box_autoadd_tls_settings( TlsSettings self, SseSerializer serializer) { @@ -1793,13 +2313,22 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { void sse_encode_client_settings( ClientSettings self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs - sse_encode_opt_box_autoadd_Chrono_Duration(self.timeout, serializer); - sse_encode_opt_box_autoadd_Chrono_Duration(self.connectTimeout, serializer); + sse_encode_opt_box_autoadd_timeout_settings( + self.timeoutSettings, serializer); sse_encode_bool(self.throwOnStatusCode, serializer); sse_encode_opt_box_autoadd_proxy_settings(self.proxySettings, serializer); sse_encode_opt_box_autoadd_redirect_settings( self.redirectSettings, serializer); sse_encode_opt_box_autoadd_tls_settings(self.tlsSettings, serializer); + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + self.dnsSettings, serializer); + } + + @protected + void sse_encode_custom_proxy(CustomProxy self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.url, serializer); + sse_encode_proxy_condition(self.condition, serializer); } @protected @@ -1870,6 +2399,25 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putPlatformInt64(self); } + @protected + void sse_encode_list_String(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_String(item, serializer); + } + } + + @protected + void sse_encode_list_custom_proxy( + List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_custom_proxy(item, serializer); + } + } + @protected void sse_encode_list_list_prim_u_8_strict( List self, SseSerializer serializer) { @@ -1897,6 +2445,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putUint8List(self); } + @protected + void sse_encode_list_record_string_list_string( + List<(String, List)> self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_record_string_list_string(item, serializer); + } + } + @protected void sse_encode_list_record_string_string( List<(String, String)> self, SseSerializer serializer) { @@ -1920,6 +2478,29 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_String(self, serializer); + } + } + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + self, serializer); + } + } + @protected void sse_encode_opt_box_autoadd_Chrono_Duration( Duration? self, SseSerializer serializer) { @@ -1986,6 +2567,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_box_autoadd_timeout_settings( + TimeoutSettings? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_timeout_settings(self, serializer); + } + } + @protected void sse_encode_opt_box_autoadd_tls_settings( TlsSettings? self, SseSerializer serializer) { @@ -2031,11 +2623,32 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } @protected - void sse_encode_proxy_settings(ProxySettings self, SseSerializer serializer) { + void sse_encode_proxy_condition( + ProxyCondition self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs sse_encode_i_32(self.index, serializer); } + @protected + void sse_encode_proxy_settings(ProxySettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + switch (self) { + case ProxySettings_NoProxy(): + sse_encode_i_32(0, serializer); + case ProxySettings_CustomProxyList(field0: final field0): + sse_encode_i_32(1, serializer); + sse_encode_list_custom_proxy(field0, serializer); + } + } + + @protected + void sse_encode_record_string_list_string( + (String, List) self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.$1, serializer); + sse_encode_list_String(self.$2, serializer); + } + @protected void sse_encode_record_string_string( (String, String) self, SseSerializer serializer) { @@ -2088,6 +2701,25 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_Map_String_list_String(self.overrides, serializer); + sse_encode_opt_String(self.fallback, serializer); + } + + @protected + void sse_encode_timeout_settings( + TimeoutSettings self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_box_autoadd_Chrono_Duration(self.timeout, serializer); + sse_encode_opt_box_autoadd_Chrono_Duration(self.connectTimeout, serializer); + sse_encode_opt_box_autoadd_Chrono_Duration( + self.keepAliveTimeout, serializer); + sse_encode_opt_box_autoadd_Chrono_Duration(self.keepAlivePing, serializer); + } + @protected void sse_encode_tls_settings(TlsSettings self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2152,6 +2784,26 @@ class CancellationTokenImpl extends RustOpaque implements CancellationToken { ); } +@sealed +class DnsSettingsImpl extends RustOpaque implements DnsSettings { + // Not to be used by end users + DnsSettingsImpl.frbInternalDcoDecode(List wire) + : super.frbInternalDcoDecode(wire, _kStaticData); + + // Not to be used by end users + DnsSettingsImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative) + : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData); + + static final _kStaticData = RustArcStaticData( + rustArcIncrementStrongCount: + RustLib.instance.api.rust_arc_increment_strong_count_DnsSettings, + rustArcDecrementStrongCount: + RustLib.instance.api.rust_arc_decrement_strong_count_DnsSettings, + rustArcDecrementStrongCountPtr: + RustLib.instance.api.rust_arc_decrement_strong_count_DnsSettingsPtr, + ); +} + @sealed class RequestClientImpl extends RustOpaque implements RequestClient { // Not to be used by end users diff --git a/lib/src/rust/frb_generated.io.dart b/lib/src/rust/frb_generated.io.dart index df20bf23..aabe90fe 100644 --- a/lib/src/rust/frb_generated.io.dart +++ b/lib/src/rust/frb_generated.io.dart @@ -26,6 +26,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_CancellationTokenPtr => wire ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationTokenPtr; + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_DnsSettingsPtr => wire + ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettingsPtr; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_RequestClientPtr => wire ._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClientPtr; @@ -43,6 +47,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( dynamic raw); + @protected + DnsSettings + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected RequestClient dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -66,6 +75,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException( dynamic raw); + @protected + FutureOr> Function(String) + dco_decode_DartFn_Inputs_String_Output_list_String_AnyhowException( + dynamic raw); + @protected FutureOr Function(HttpResponse) dco_decode_DartFn_Inputs_http_response_Output_unit_AnyhowException( @@ -82,11 +96,19 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Map dco_decode_Map_String_String(dynamic raw); + @protected + Map> dco_decode_Map_String_list_String(dynamic raw); + @protected CancellationToken dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( dynamic raw); + @protected + DnsSettings + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected RequestClient dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -99,9 +121,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String dco_decode_String(dynamic raw); + @protected + SocketAddrDigester dco_decode_TraitDef_SocketAddrDigester(dynamic raw); + @protected bool dco_decode_bool(dynamic raw); + @protected + DnsSettings + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected Duration dco_decode_box_autoadd_Chrono_Duration(dynamic raw); @@ -123,6 +153,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RedirectSettings dco_decode_box_autoadd_redirect_settings(dynamic raw); + @protected + StaticDnsSettings dco_decode_box_autoadd_static_dns_settings(dynamic raw); + + @protected + TimeoutSettings dco_decode_box_autoadd_timeout_settings(dynamic raw); + @protected TlsSettings dco_decode_box_autoadd_tls_settings(dynamic raw); @@ -135,6 +171,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ClientSettings dco_decode_client_settings(dynamic raw); + @protected + CustomProxy dco_decode_custom_proxy(dynamic raw); + @protected HttpHeaders dco_decode_http_headers(dynamic raw); @@ -159,6 +198,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 dco_decode_isize(dynamic raw); + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List dco_decode_list_custom_proxy(dynamic raw); + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw); @@ -168,6 +213,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + @protected + List<(String, List)> dco_decode_list_record_string_list_string( + dynamic raw); + @protected List<(String, String)> dco_decode_list_record_string_string(dynamic raw); @@ -176,6 +225,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( dynamic raw); + @protected + String? dco_decode_opt_String(dynamic raw); + + @protected + DnsSettings? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected Duration? dco_decode_opt_box_autoadd_Chrono_Duration(dynamic raw); @@ -194,6 +251,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RedirectSettings? dco_decode_opt_box_autoadd_redirect_settings(dynamic raw); + @protected + TimeoutSettings? dco_decode_opt_box_autoadd_timeout_settings(dynamic raw); + @protected TlsSettings? dco_decode_opt_box_autoadd_tls_settings(dynamic raw); @@ -206,9 +266,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected List<(String, String)>? dco_decode_opt_list_record_string_string(dynamic raw); + @protected + ProxyCondition dco_decode_proxy_condition(dynamic raw); + @protected ProxySettings dco_decode_proxy_settings(dynamic raw); + @protected + (String, List) dco_decode_record_string_list_string(dynamic raw); + @protected (String, String) dco_decode_record_string_string(dynamic raw); @@ -218,6 +284,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RhttpError dco_decode_rhttp_error(dynamic raw); + @protected + StaticDnsSettings dco_decode_static_dns_settings(dynamic raw); + + @protected + TimeoutSettings dco_decode_timeout_settings(dynamic raw); + @protected TlsSettings dco_decode_tls_settings(dynamic raw); @@ -249,6 +321,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected RequestClient sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -274,11 +351,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { Map sse_decode_Map_String_String( SseDeserializer deserializer); + @protected + Map> sse_decode_Map_String_list_String( + SseDeserializer deserializer); + @protected CancellationToken sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected RequestClient sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -294,6 +380,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected bool sse_decode_bool(SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected Duration sse_decode_box_autoadd_Chrono_Duration(SseDeserializer deserializer); @@ -320,6 +411,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { RedirectSettings sse_decode_box_autoadd_redirect_settings( SseDeserializer deserializer); + @protected + StaticDnsSettings sse_decode_box_autoadd_static_dns_settings( + SseDeserializer deserializer); + + @protected + TimeoutSettings sse_decode_box_autoadd_timeout_settings( + SseDeserializer deserializer); + @protected TlsSettings sse_decode_box_autoadd_tls_settings(SseDeserializer deserializer); @@ -332,6 +431,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ClientSettings sse_decode_client_settings(SseDeserializer deserializer); + @protected + CustomProxy sse_decode_custom_proxy(SseDeserializer deserializer); + @protected HttpHeaders sse_decode_http_headers(SseDeserializer deserializer); @@ -356,6 +458,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 sse_decode_isize(SseDeserializer deserializer); + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_custom_proxy(SseDeserializer deserializer); + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer); @@ -366,6 +474,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + @protected + List<(String, List)> sse_decode_list_record_string_list_string( + SseDeserializer deserializer); + @protected List<(String, String)> sse_decode_list_record_string_string( SseDeserializer deserializer); @@ -375,6 +487,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( SseDeserializer deserializer); + @protected + String? sse_decode_opt_String(SseDeserializer deserializer); + + @protected + DnsSettings? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected Duration? sse_decode_opt_box_autoadd_Chrono_Duration( SseDeserializer deserializer); @@ -399,6 +519,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { RedirectSettings? sse_decode_opt_box_autoadd_redirect_settings( SseDeserializer deserializer); + @protected + TimeoutSettings? sse_decode_opt_box_autoadd_timeout_settings( + SseDeserializer deserializer); + @protected TlsSettings? sse_decode_opt_box_autoadd_tls_settings( SseDeserializer deserializer); @@ -414,9 +538,16 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { List<(String, String)>? sse_decode_opt_list_record_string_string( SseDeserializer deserializer); + @protected + ProxyCondition sse_decode_proxy_condition(SseDeserializer deserializer); + @protected ProxySettings sse_decode_proxy_settings(SseDeserializer deserializer); + @protected + (String, List) sse_decode_record_string_list_string( + SseDeserializer deserializer); + @protected (String, String) sse_decode_record_string_string( SseDeserializer deserializer); @@ -427,6 +558,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RhttpError sse_decode_rhttp_error(SseDeserializer deserializer); + @protected + StaticDnsSettings sse_decode_static_dns_settings( + SseDeserializer deserializer); + + @protected + TimeoutSettings sse_decode_timeout_settings(SseDeserializer deserializer); + @protected TlsSettings sse_decode_tls_settings(SseDeserializer deserializer); @@ -459,6 +597,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( CancellationToken self, SseSerializer serializer); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -483,6 +626,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { FutureOr Function(CancellationToken) self, SseSerializer serializer); + @protected + void sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException( + FutureOr> Function(String) self, SseSerializer serializer); + @protected void sse_encode_DartFn_Inputs_http_response_Output_unit_AnyhowException( FutureOr Function(HttpResponse) self, SseSerializer serializer); @@ -498,11 +645,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_Map_String_String( Map self, SseSerializer serializer); + @protected + void sse_encode_Map_String_list_String( + Map> self, SseSerializer serializer); + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( CancellationToken self, SseSerializer serializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -518,6 +674,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_bool(bool self, SseSerializer serializer); + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_Chrono_Duration( Duration self, SseSerializer serializer); @@ -546,6 +707,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_box_autoadd_redirect_settings( RedirectSettings self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_timeout_settings( + TimeoutSettings self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_tls_settings( TlsSettings self, SseSerializer serializer); @@ -562,6 +731,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_client_settings( ClientSettings self, SseSerializer serializer); + @protected + void sse_encode_custom_proxy(CustomProxy self, SseSerializer serializer); + @protected void sse_encode_http_headers(HttpHeaders self, SseSerializer serializer); @@ -587,6 +759,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_isize(PlatformInt64 self, SseSerializer serializer); + @protected + void sse_encode_list_String(List self, SseSerializer serializer); + + @protected + void sse_encode_list_custom_proxy( + List self, SseSerializer serializer); + @protected void sse_encode_list_list_prim_u_8_strict( List self, SseSerializer serializer); @@ -598,6 +777,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_list_prim_u_8_strict( Uint8List self, SseSerializer serializer); + @protected + void sse_encode_list_record_string_list_string( + List<(String, List)> self, SseSerializer serializer); + @protected void sse_encode_list_record_string_string( List<(String, String)> self, SseSerializer serializer); @@ -607,6 +790,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_encode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( RequestClient? self, SseSerializer serializer); + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_Chrono_Duration( Duration? self, SseSerializer serializer); @@ -631,6 +822,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_box_autoadd_redirect_settings( RedirectSettings? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_timeout_settings( + TimeoutSettings? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_tls_settings( TlsSettings? self, SseSerializer serializer); @@ -647,9 +842,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_list_record_string_string( List<(String, String)>? self, SseSerializer serializer); + @protected + void sse_encode_proxy_condition( + ProxyCondition self, SseSerializer serializer); + @protected void sse_encode_proxy_settings(ProxySettings self, SseSerializer serializer); + @protected + void sse_encode_record_string_list_string( + (String, List) self, SseSerializer serializer); + @protected void sse_encode_record_string_string( (String, String) self, SseSerializer serializer); @@ -661,6 +864,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_rhttp_error(RhttpError self, SseSerializer serializer); + @protected + void sse_encode_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer); + + @protected + void sse_encode_timeout_settings( + TimeoutSettings self, SseSerializer serializer); + @protected void sse_encode_tls_settings(TlsSettings self, SseSerializer serializer); @@ -726,6 +937,38 @@ class RustLibWire implements BaseWire { _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationTokenPtr .asFunction)>(); + void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ffi.Pointer ptr, + ) { + return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr, + ); + } + + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettingsPtr = + _lookup)>>( + 'frbgen_mangayomi_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings'); + late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings = + _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettingsPtr + .asFunction)>(); + + void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ffi.Pointer ptr, + ) { + return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr, + ); + } + + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettingsPtr = + _lookup)>>( + 'frbgen_mangayomi_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings'); + late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings = + _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettingsPtr + .asFunction)>(); + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( ffi.Pointer ptr, diff --git a/lib/src/rust/frb_generated.web.dart b/lib/src/rust/frb_generated.web.dart index a0ccf543..eea24570 100644 --- a/lib/src/rust/frb_generated.web.dart +++ b/lib/src/rust/frb_generated.web.dart @@ -28,6 +28,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { get rust_arc_decrement_strong_count_CancellationTokenPtr => wire .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken; + CrossPlatformFinalizerArg + get rust_arc_decrement_strong_count_DnsSettingsPtr => wire + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings; + CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_RequestClientPtr => wire .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient; @@ -45,6 +49,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( dynamic raw); + @protected + DnsSettings + dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected RequestClient dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -68,6 +77,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException( dynamic raw); + @protected + FutureOr> Function(String) + dco_decode_DartFn_Inputs_String_Output_list_String_AnyhowException( + dynamic raw); + @protected FutureOr Function(HttpResponse) dco_decode_DartFn_Inputs_http_response_Output_unit_AnyhowException( @@ -84,11 +98,19 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Map dco_decode_Map_String_String(dynamic raw); + @protected + Map> dco_decode_Map_String_list_String(dynamic raw); + @protected CancellationToken dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( dynamic raw); + @protected + DnsSettings + dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected RequestClient dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -101,9 +123,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String dco_decode_String(dynamic raw); + @protected + SocketAddrDigester dco_decode_TraitDef_SocketAddrDigester(dynamic raw); + @protected bool dco_decode_bool(dynamic raw); + @protected + DnsSettings + dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected Duration dco_decode_box_autoadd_Chrono_Duration(dynamic raw); @@ -125,6 +155,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RedirectSettings dco_decode_box_autoadd_redirect_settings(dynamic raw); + @protected + StaticDnsSettings dco_decode_box_autoadd_static_dns_settings(dynamic raw); + + @protected + TimeoutSettings dco_decode_box_autoadd_timeout_settings(dynamic raw); + @protected TlsSettings dco_decode_box_autoadd_tls_settings(dynamic raw); @@ -137,6 +173,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ClientSettings dco_decode_client_settings(dynamic raw); + @protected + CustomProxy dco_decode_custom_proxy(dynamic raw); + @protected HttpHeaders dco_decode_http_headers(dynamic raw); @@ -161,6 +200,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 dco_decode_isize(dynamic raw); + @protected + List dco_decode_list_String(dynamic raw); + + @protected + List dco_decode_list_custom_proxy(dynamic raw); + @protected List dco_decode_list_list_prim_u_8_strict(dynamic raw); @@ -170,6 +215,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + @protected + List<(String, List)> dco_decode_list_record_string_list_string( + dynamic raw); + @protected List<(String, String)> dco_decode_list_record_string_string(dynamic raw); @@ -178,6 +227,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { dco_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( dynamic raw); + @protected + String? dco_decode_opt_String(dynamic raw); + + @protected + DnsSettings? + dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + dynamic raw); + @protected Duration? dco_decode_opt_box_autoadd_Chrono_Duration(dynamic raw); @@ -196,6 +253,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RedirectSettings? dco_decode_opt_box_autoadd_redirect_settings(dynamic raw); + @protected + TimeoutSettings? dco_decode_opt_box_autoadd_timeout_settings(dynamic raw); + @protected TlsSettings? dco_decode_opt_box_autoadd_tls_settings(dynamic raw); @@ -208,9 +268,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected List<(String, String)>? dco_decode_opt_list_record_string_string(dynamic raw); + @protected + ProxyCondition dco_decode_proxy_condition(dynamic raw); + @protected ProxySettings dco_decode_proxy_settings(dynamic raw); + @protected + (String, List) dco_decode_record_string_list_string(dynamic raw); + @protected (String, String) dco_decode_record_string_string(dynamic raw); @@ -220,6 +286,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RhttpError dco_decode_rhttp_error(dynamic raw); + @protected + StaticDnsSettings dco_decode_static_dns_settings(dynamic raw); + + @protected + TimeoutSettings dco_decode_timeout_settings(dynamic raw); + @protected TlsSettings dco_decode_tls_settings(dynamic raw); @@ -251,6 +323,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected RequestClient sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -276,11 +353,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { Map sse_decode_Map_String_String( SseDeserializer deserializer); + @protected + Map> sse_decode_Map_String_list_String( + SseDeserializer deserializer); + @protected CancellationToken sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected RequestClient sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -296,6 +382,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected bool sse_decode_bool(SseDeserializer deserializer); + @protected + DnsSettings + sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected Duration sse_decode_box_autoadd_Chrono_Duration(SseDeserializer deserializer); @@ -322,6 +413,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { RedirectSettings sse_decode_box_autoadd_redirect_settings( SseDeserializer deserializer); + @protected + StaticDnsSettings sse_decode_box_autoadd_static_dns_settings( + SseDeserializer deserializer); + + @protected + TimeoutSettings sse_decode_box_autoadd_timeout_settings( + SseDeserializer deserializer); + @protected TlsSettings sse_decode_box_autoadd_tls_settings(SseDeserializer deserializer); @@ -334,6 +433,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ClientSettings sse_decode_client_settings(SseDeserializer deserializer); + @protected + CustomProxy sse_decode_custom_proxy(SseDeserializer deserializer); + @protected HttpHeaders sse_decode_http_headers(SseDeserializer deserializer); @@ -358,6 +460,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PlatformInt64 sse_decode_isize(SseDeserializer deserializer); + @protected + List sse_decode_list_String(SseDeserializer deserializer); + + @protected + List sse_decode_list_custom_proxy(SseDeserializer deserializer); + @protected List sse_decode_list_list_prim_u_8_strict( SseDeserializer deserializer); @@ -368,6 +476,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + @protected + List<(String, List)> sse_decode_list_record_string_list_string( + SseDeserializer deserializer); + @protected List<(String, String)> sse_decode_list_record_string_string( SseDeserializer deserializer); @@ -377,6 +489,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( SseDeserializer deserializer); + @protected + String? sse_decode_opt_String(SseDeserializer deserializer); + + @protected + DnsSettings? + sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + SseDeserializer deserializer); + @protected Duration? sse_decode_opt_box_autoadd_Chrono_Duration( SseDeserializer deserializer); @@ -401,6 +521,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { RedirectSettings? sse_decode_opt_box_autoadd_redirect_settings( SseDeserializer deserializer); + @protected + TimeoutSettings? sse_decode_opt_box_autoadd_timeout_settings( + SseDeserializer deserializer); + @protected TlsSettings? sse_decode_opt_box_autoadd_tls_settings( SseDeserializer deserializer); @@ -416,9 +540,16 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { List<(String, String)>? sse_decode_opt_list_record_string_string( SseDeserializer deserializer); + @protected + ProxyCondition sse_decode_proxy_condition(SseDeserializer deserializer); + @protected ProxySettings sse_decode_proxy_settings(SseDeserializer deserializer); + @protected + (String, List) sse_decode_record_string_list_string( + SseDeserializer deserializer); + @protected (String, String) sse_decode_record_string_string( SseDeserializer deserializer); @@ -429,6 +560,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected RhttpError sse_decode_rhttp_error(SseDeserializer deserializer); + @protected + StaticDnsSettings sse_decode_static_dns_settings( + SseDeserializer deserializer); + + @protected + TimeoutSettings sse_decode_timeout_settings(SseDeserializer deserializer); + @protected TlsSettings sse_decode_tls_settings(SseDeserializer deserializer); @@ -461,6 +599,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( CancellationToken self, SseSerializer serializer); + @protected + void + sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -485,6 +628,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { FutureOr Function(CancellationToken) self, SseSerializer serializer); + @protected + void sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException( + FutureOr> Function(String) self, SseSerializer serializer); + @protected void sse_encode_DartFn_Inputs_http_response_Output_unit_AnyhowException( FutureOr Function(HttpResponse) self, SseSerializer serializer); @@ -500,11 +647,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_Map_String_String( Map self, SseSerializer serializer); + @protected + void sse_encode_Map_String_list_String( + Map> self, SseSerializer serializer); + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( CancellationToken self, SseSerializer serializer); + @protected + void + sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( @@ -520,6 +676,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_bool(bool self, SseSerializer serializer); + @protected + void + sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_Chrono_Duration( Duration self, SseSerializer serializer); @@ -548,6 +709,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_box_autoadd_redirect_settings( RedirectSettings self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_timeout_settings( + TimeoutSettings self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_tls_settings( TlsSettings self, SseSerializer serializer); @@ -564,6 +733,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_client_settings( ClientSettings self, SseSerializer serializer); + @protected + void sse_encode_custom_proxy(CustomProxy self, SseSerializer serializer); + @protected void sse_encode_http_headers(HttpHeaders self, SseSerializer serializer); @@ -589,6 +761,13 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_isize(PlatformInt64 self, SseSerializer serializer); + @protected + void sse_encode_list_String(List self, SseSerializer serializer); + + @protected + void sse_encode_list_custom_proxy( + List self, SseSerializer serializer); + @protected void sse_encode_list_list_prim_u_8_strict( List self, SseSerializer serializer); @@ -600,6 +779,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_list_prim_u_8_strict( Uint8List self, SseSerializer serializer); + @protected + void sse_encode_list_record_string_list_string( + List<(String, List)> self, SseSerializer serializer); + @protected void sse_encode_list_record_string_string( List<(String, String)> self, SseSerializer serializer); @@ -609,6 +792,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { sse_encode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( RequestClient? self, SseSerializer serializer); + @protected + void sse_encode_opt_String(String? self, SseSerializer serializer); + + @protected + void + sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + DnsSettings? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_Chrono_Duration( Duration? self, SseSerializer serializer); @@ -633,6 +824,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_box_autoadd_redirect_settings( RedirectSettings? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_timeout_settings( + TimeoutSettings? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_tls_settings( TlsSettings? self, SseSerializer serializer); @@ -649,9 +844,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { void sse_encode_opt_list_record_string_string( List<(String, String)>? self, SseSerializer serializer); + @protected + void sse_encode_proxy_condition( + ProxyCondition self, SseSerializer serializer); + @protected void sse_encode_proxy_settings(ProxySettings self, SseSerializer serializer); + @protected + void sse_encode_record_string_list_string( + (String, List) self, SseSerializer serializer); + @protected void sse_encode_record_string_string( (String, String) self, SseSerializer serializer); @@ -663,6 +866,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_rhttp_error(RhttpError self, SseSerializer serializer); + @protected + void sse_encode_static_dns_settings( + StaticDnsSettings self, SseSerializer serializer); + + @protected + void sse_encode_timeout_settings( + TimeoutSettings self, SseSerializer serializer); + @protected void sse_encode_tls_settings(TlsSettings self, SseSerializer serializer); @@ -699,6 +910,18 @@ class RustLibWire implements BaseWire { .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( ptr); + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + int ptr) => + wasmModule + .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr); + + void rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + int ptr) => + wasmModule + .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr); + void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( int ptr) => wasmModule @@ -726,6 +949,14 @@ extension type RustLibWasmModule._(JSObject _) implements JSObject { rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken( int ptr); + external void + rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + int ptr); + + external void + rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + int ptr); + external void rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( int ptr); diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 0f2c1c83..5452e778 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1616,6 +1616,7 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-rustls", + "tokio-socks", "tokio-util", "tower-service", "url", @@ -2022,6 +2023,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-socks" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" +dependencies = [ + "either", + "futures-util", + "thiserror", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.12" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 0ea8372c..d94b0d0b 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -11,6 +11,6 @@ flutter_rust_bridge = { version = "=2.7.0", features = ["chrono"] } image = "0.25.5" chrono = "0.4.38" futures-util = "0.3.31" -reqwest = { version = "0.12.9", default-features = false, features = ["charset", "http2", "rustls-tls", "rustls-tls-native-roots", "stream", "multipart", "brotli", "gzip"] } +reqwest = { version = "0.12.9", default-features = false, features = ["charset", "http2", "rustls-tls", "rustls-tls-native-roots", "stream", "multipart", "socks", "brotli", "gzip"] } tokio = { version = "1.41.1", features = ["full"] } tokio-util = "0.7.12" diff --git a/rust/src/api/rhttp/client.rs b/rust/src/api/rhttp/client.rs index 62057fa1..ceb28bf8 100644 --- a/rust/src/api/rhttp/client.rs +++ b/rust/src/api/rhttp/client.rs @@ -1,26 +1,46 @@ +use std::str::FromStr; +use std::{collections::HashMap, net::SocketAddr, sync::Arc}; + use crate::api::rhttp::error::RhttpError; use chrono::Duration; +use flutter_rust_bridge::{frb, DartFnFuture}; +use reqwest::dns::{Addrs, Name, Resolve, Resolving}; use reqwest::{tls, Certificate}; pub use tokio_util::sync::CancellationToken; pub struct ClientSettings { - pub timeout: Option, - pub connect_timeout: Option, + pub timeout_settings: Option, pub throw_on_status_code: bool, pub proxy_settings: Option, pub redirect_settings: Option, pub tls_settings: Option, + pub dns_settings: Option, } pub enum ProxySettings { NoProxy, + CustomProxyList(Vec), } +pub struct CustomProxy { + pub url: String, + pub condition: ProxyCondition, +} +pub enum ProxyCondition { + Http, + Https, + All, +} pub enum RedirectSettings { NoRedirect, LimitedRedirects(i32), } - +pub struct TimeoutSettings { + pub timeout: Option, + pub connect_timeout: Option, + pub keep_alive_timeout: Option, + pub keep_alive_ping: Option, +} pub struct TlsSettings { pub trust_root_certificates: bool, pub trusted_root_certificates: Vec>, @@ -30,6 +50,21 @@ pub struct TlsSettings { pub max_tls_version: Option, } +pub enum DnsSettings { + StaticDns(StaticDnsSettings), + DynamicDns(DynamicDnsSettings), +} + +pub struct StaticDnsSettings { + pub overrides: HashMap>, + pub fallback: Option, +} + +pub struct DynamicDnsSettings { + /// A function that takes a hostname and returns a future that resolves to an IP address. + resolver: Arc DartFnFuture> + 'static + Send + Sync>, +} + pub struct ClientCertificate { pub certificate: Vec, pub private_key: Vec, @@ -43,12 +78,12 @@ pub enum TlsVersion { impl Default for ClientSettings { fn default() -> Self { ClientSettings { - timeout: None, - connect_timeout: None, + timeout_settings: None, throw_on_status_code: true, proxy_settings: None, redirect_settings: None, tls_settings: None, + dns_settings: None, } } } @@ -78,6 +113,19 @@ fn create_client(settings: ClientSettings) -> Result if let Some(proxy_settings) = settings.proxy_settings { match proxy_settings { ProxySettings::NoProxy => client = client.no_proxy(), + ProxySettings::CustomProxyList(proxies) => { + for proxy in proxies { + let proxy = match proxy.condition { + ProxyCondition::Http => reqwest::Proxy::http(&proxy.url), + ProxyCondition::Https => reqwest::Proxy::https(&proxy.url), + ProxyCondition::All => reqwest::Proxy::all(&proxy.url), + } + .map_err(|e| { + RhttpError::RhttpUnknownError(format!("Error creating proxy: {e:?}")) + })?; + client = client.proxy(proxy); + } + } } } @@ -90,19 +138,40 @@ fn create_client(settings: ClientSettings) -> Result }; } - if let Some(timeout) = settings.timeout { - client = client.timeout( - timeout + if let Some(timeout_settings) = settings.timeout_settings { + if let Some(timeout) = timeout_settings.timeout { + client = client.timeout( + timeout + .to_std() + .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?, + ); + } + if let Some(timeout) = timeout_settings.connect_timeout { + client = client.connect_timeout( + timeout + .to_std() + .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?, + ); + } + + if let Some(keep_alive_timeout) = timeout_settings.keep_alive_timeout { + let timeout = keep_alive_timeout .to_std() - .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?, - ); - } - if let Some(timeout) = settings.connect_timeout { - client = client.connect_timeout( - timeout - .to_std() - .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?, - ); + .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?; + if timeout.as_millis() > 0 { + client = client.tcp_keepalive(timeout); + client = client.http2_keep_alive_while_idle(true); + client = client.http2_keep_alive_timeout(timeout); + } + } + + if let Some(keep_alive_ping) = timeout_settings.keep_alive_ping { + client = client.http2_keep_alive_interval( + keep_alive_ping + .to_std() + .map_err(|e| RhttpError::RhttpUnknownError(e.to_string()))?, + ); + } } if let Some(tls_settings) = settings.tls_settings { @@ -151,6 +220,46 @@ fn create_client(settings: ClientSettings) -> Result }); } } + if let Some(dns_settings) = settings.dns_settings { + match dns_settings { + DnsSettings::StaticDns(settings) => { + if let Some(fallback) = settings.fallback { + client = client.dns_resolver(Arc::new(StaticResolver { + address: SocketAddr::from_str(fallback.digest_ip().as_str()) + .map_err(|e| RhttpError::RhttpUnknownError(format!("{e:?}")))?, + })); + } + + for dns_override in settings.overrides { + let (hostname, ip) = dns_override; + let hostname = hostname.as_str(); + let mut err: Option = None; + let ip = ip + .into_iter() + .map(|ip| { + let ip_digested = ip.digest_ip(); + SocketAddr::from_str(ip_digested.as_str()).map_err(|e| { + err = Some(format!("Invalid IP address: {ip_digested}. {e:?}")); + RhttpError::RhttpUnknownError(e.to_string()) + }) + }) + .filter_map(Result::ok) + .collect::>(); + + if let Some(error) = err { + return Err(RhttpError::RhttpUnknownError(error)); + } + + client = client.resolve_to_addrs(hostname, ip.as_slice()); + } + } + DnsSettings::DynamicDns(settings) => { + client = client.dns_resolver(Arc::new(DynamicResolver { + resolver: settings.resolver, + })); + } + } + } client .build() @@ -163,3 +272,85 @@ fn create_client(settings: ClientSettings) -> Result cancel_token: CancellationToken::new(), }) } + +struct StaticResolver { + address: SocketAddr, +} + +impl Resolve for StaticResolver { + fn resolve(&self, _: Name) -> Resolving { + let addrs: Addrs = Box::new(vec![self.address].clone().into_iter()); + Box::pin(futures_util::future::ready(Ok(addrs))) + } +} + +struct DynamicResolver { + resolver: Arc DartFnFuture> + 'static + Send + Sync>, +} + +impl Resolve for DynamicResolver { + fn resolve(&self, name: Name) -> Resolving { + let resolver = self.resolver.clone(); + Box::pin(async move { + let ip = resolver(name.as_str().to_owned()).await; + let ip = ip + .into_iter() + .map(|ip| { + let ip_digested = ip.digest_ip(); + SocketAddr::from_str(ip_digested.as_str()).map_err(|e| { + RhttpError::RhttpUnknownError(format!( + "Invalid IP address: {ip_digested}. {e:?}" + )) + }) + }) + .filter_map(Result::ok) + .collect::>(); + + let addrs: Addrs = Box::new(ip.into_iter()); + + Ok(addrs) + }) + } +} + +#[frb(sync)] +pub fn create_static_resolver_sync(settings: StaticDnsSettings) -> DnsSettings { + DnsSettings::StaticDns(settings) +} + +#[frb(sync)] +pub fn create_dynamic_resolver_sync( + resolver: impl Fn(String) -> DartFnFuture> + 'static + Send + Sync, +) -> DnsSettings { + DnsSettings::DynamicDns(DynamicDnsSettings { + resolver: Arc::new(resolver), + }) +} + +// According to reqwest documentation, +// the port "0" will use the "conventional port for the given scheme" +// e.g. 80 for HTTP, 443 for HTTPS. +const FALLBACK_PORT: &'static str = "0"; + +pub(crate) trait SocketAddrDigester { + /// Adds the `FALLBACK_PORT` to the end of the string if it doesn't have a port. + fn digest_ip(self) -> String; +} + +impl SocketAddrDigester for String { + fn digest_ip(self) -> String { + let has_dot = self.contains("."); + + if has_dot && !self.contains(":") { + // IPv4 without port + return format!("{self}:{FALLBACK_PORT}"); + } + + if !has_dot && !self.contains("[") { + // IPv6 without port + return format!("[{self}]:{FALLBACK_PORT}"); + } + + self + } +} diff --git a/rust/src/frb_generated.rs b/rust/src/frb_generated.rs index e6a20ed9..e9823474 100644 --- a/rust/src/frb_generated.rs +++ b/rust/src/frb_generated.rs @@ -39,7 +39,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueMoi, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.7.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 107666026; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 885218533; // Section: executor @@ -184,6 +184,73 @@ fn wire__crate__api__rhttp__client__client_settings_default_impl( }, ) } +fn wire__crate__api__rhttp__client__create_dynamic_resolver_sync_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "create_dynamic_resolver_sync", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_resolver = decode_DartFn_Inputs_String_Output_list_String_AnyhowException( + ::sse_decode(&mut deserializer), + ); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let output_ok = Result::<_, ()>::Ok( + crate::api::rhttp::client::create_dynamic_resolver_sync(api_resolver), + )?; + Ok(output_ok) + })()) + }, + ) +} +fn wire__crate__api__rhttp__client__create_static_resolver_sync_impl( + ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, + rust_vec_len_: i32, + data_len_: i32, +) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_sync::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "create_static_resolver_sync", + port: None, + mode: flutter_rust_bridge::for_generated::FfiCallMode::Sync, + }, + move || { + let message = unsafe { + flutter_rust_bridge::for_generated::Dart2RustMessageSse::from_wire( + ptr_, + rust_vec_len_, + data_len_, + ) + }; + let mut deserializer = + flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let api_settings = + ::sse_decode(&mut deserializer); + deserializer.end(); + transform_result_sse::<_, ()>((move || { + let output_ok = Result::<_, ()>::Ok( + crate::api::rhttp::client::create_static_resolver_sync(api_settings), + )?; + Ok(output_ok) + })()) + }, + ) +} fn wire__crate__api__rhttp__http__make_http_request_receive_stream_impl( port_: flutter_rust_bridge::for_generated::MessagePort, ptr_: flutter_rust_bridge::for_generated::PlatformGeneralizedUint8ListPtr, @@ -345,6 +412,38 @@ fn decode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRu )) } } +fn decode_DartFn_Inputs_String_Output_list_String_AnyhowException( + dart_opaque: flutter_rust_bridge::DartOpaque, +) -> impl Fn(String) -> flutter_rust_bridge::DartFnFuture> { + use flutter_rust_bridge::IntoDart; + + async fn body(dart_opaque: flutter_rust_bridge::DartOpaque, arg0: String) -> Vec { + let args = vec![arg0.into_into_dart().into_dart()]; + let message = FLUTTER_RUST_BRIDGE_HANDLER + .dart_fn_invoke(dart_opaque, args) + .await; + + let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); + let action = deserializer.cursor.read_u8().unwrap(); + let ans = match action { + 0 => std::result::Result::Ok(>::sse_decode(&mut deserializer)), + 1 => std::result::Result::Err( + ::sse_decode(&mut deserializer), + ), + _ => unreachable!(), + }; + deserializer.end(); + let ans = ans.expect("Dart throws exception but Rust side assume it is not failable"); + ans + } + + move |arg0: String| { + flutter_rust_bridge::for_generated::convert_into_dart_fn_future(body( + dart_opaque.clone(), + arg0, + )) + } +} fn decode_DartFn_Inputs_http_response_Output_unit_AnyhowException( dart_opaque: flutter_rust_bridge::DartOpaque, ) -> impl Fn(crate::api::rhttp::http::HttpResponse) -> flutter_rust_bridge::DartFnFuture<()> { @@ -418,6 +517,9 @@ fn decode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException( flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); +flutter_rust_bridge::frb_generated_moi_arc_impl_value!( + flutter_rust_bridge::for_generated::RustAutoOpaqueInner +); flutter_rust_bridge::frb_generated_moi_arc_impl_value!( flutter_rust_bridge::for_generated::RustAutoOpaqueInner ); @@ -452,6 +554,16 @@ impl SseDecode for CancellationToken { } } +impl SseDecode for DnsSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = , + >>::sse_decode(deserializer); + return flutter_rust_bridge::for_generated::rust_auto_opaque_decode_owned(inner); + } +} + impl SseDecode for RequestClient { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -486,6 +598,14 @@ impl SseDecode for std::collections::HashMap { } } +impl SseDecode for std::collections::HashMap> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = )>>::sse_decode(deserializer); + return inner.into_iter().collect(); + } +} + impl SseDecode for RustOpaqueMoi> { @@ -496,6 +616,16 @@ impl SseDecode } } +impl SseDecode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut inner = ::sse_decode(deserializer); + return decode_rust_opaque_moi(inner); + } +} + impl SseDecode for RustOpaqueMoi> { @@ -544,8 +674,8 @@ impl SseDecode for crate::api::rhttp::client::ClientCertificate { impl SseDecode for crate::api::rhttp::client::ClientSettings { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { - let mut var_timeout = >::sse_decode(deserializer); - let mut var_connectTimeout = >::sse_decode(deserializer); + let mut var_timeoutSettings = + >::sse_decode(deserializer); let mut var_throwOnStatusCode = ::sse_decode(deserializer); let mut var_proxySettings = >::sse_decode(deserializer); @@ -553,13 +683,27 @@ impl SseDecode for crate::api::rhttp::client::ClientSettings { >::sse_decode(deserializer); let mut var_tlsSettings = >::sse_decode(deserializer); + let mut var_dnsSettings = >::sse_decode(deserializer); return crate::api::rhttp::client::ClientSettings { - timeout: var_timeout, - connect_timeout: var_connectTimeout, + timeout_settings: var_timeoutSettings, throw_on_status_code: var_throwOnStatusCode, proxy_settings: var_proxySettings, redirect_settings: var_redirectSettings, tls_settings: var_tlsSettings, + dns_settings: var_dnsSettings, + }; + } +} + +impl SseDecode for crate::api::rhttp::client::CustomProxy { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_url = ::sse_decode(deserializer); + let mut var_condition = + ::sse_decode(deserializer); + return crate::api::rhttp::client::CustomProxy { + url: var_url, + condition: var_condition, }; } } @@ -678,6 +822,32 @@ impl SseDecode for isize { } } +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode( + deserializer, + )); + } + return ans_; + } +} + impl SseDecode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -702,6 +872,18 @@ impl SseDecode for Vec { } } +impl SseDecode for Vec<(String, Vec)> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(<(String, Vec)>::sse_decode(deserializer)); + } + return ans_; + } +} + impl SseDecode for Vec<(String, String)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -725,6 +907,28 @@ impl SseDecode for Option> { } } +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + impl SseDecode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -801,6 +1005,19 @@ impl SseDecode for Option { } } +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode( + deserializer, + )); + } else { + return None; + } + } +} + impl SseDecode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -849,17 +1066,48 @@ impl SseDecode for Option> { } } -impl SseDecode for crate::api::rhttp::client::ProxySettings { +impl SseDecode for crate::api::rhttp::client::ProxyCondition { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { let mut inner = ::sse_decode(deserializer); return match inner { - 0 => crate::api::rhttp::client::ProxySettings::NoProxy, - _ => unreachable!("Invalid variant for ProxySettings: {}", inner), + 0 => crate::api::rhttp::client::ProxyCondition::Http, + 1 => crate::api::rhttp::client::ProxyCondition::Https, + 2 => crate::api::rhttp::client::ProxyCondition::All, + _ => unreachable!("Invalid variant for ProxyCondition: {}", inner), }; } } +impl SseDecode for crate::api::rhttp::client::ProxySettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut tag_ = ::sse_decode(deserializer); + match tag_ { + 0 => { + return crate::api::rhttp::client::ProxySettings::NoProxy; + } + 1 => { + let mut var_field0 = + >::sse_decode(deserializer); + return crate::api::rhttp::client::ProxySettings::CustomProxyList(var_field0); + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseDecode for (String, Vec) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_field0 = ::sse_decode(deserializer); + let mut var_field1 = >::sse_decode(deserializer); + return (var_field0, var_field1); + } +} + impl SseDecode for (String, String) { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -932,6 +1180,35 @@ impl SseDecode for crate::api::rhttp::error::RhttpError { } } +impl SseDecode for crate::api::rhttp::client::StaticDnsSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_overrides = + >>::sse_decode(deserializer); + let mut var_fallback = >::sse_decode(deserializer); + return crate::api::rhttp::client::StaticDnsSettings { + overrides: var_overrides, + fallback: var_fallback, + }; + } +} + +impl SseDecode for crate::api::rhttp::client::TimeoutSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_timeout = >::sse_decode(deserializer); + let mut var_connectTimeout = >::sse_decode(deserializer); + let mut var_keepAliveTimeout = >::sse_decode(deserializer); + let mut var_keepAlivePing = >::sse_decode(deserializer); + return crate::api::rhttp::client::TimeoutSettings { + timeout: var_timeout, + connect_timeout: var_connectTimeout, + keep_alive_timeout: var_keepAliveTimeout, + keep_alive_ping: var_keepAlivePing, + }; + } +} + impl SseDecode for crate::api::rhttp::client::TlsSettings { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1002,26 +1279,26 @@ fn pde_ffi_dispatcher_primary_impl( ) { // Codec=Pde (Serialization + dispatch), see doc to use other codecs match func_id { - 1 => wire__crate__api__rhttp__http__cancel_request_impl(port, ptr, rust_vec_len, data_len), - 2 => wire__crate__api__rhttp__http__cancel_running_requests_impl( + 2 => wire__crate__api__rhttp__http__cancel_request_impl(port, ptr, rust_vec_len, data_len), + 3 => wire__crate__api__rhttp__http__cancel_running_requests_impl( port, ptr, rust_vec_len, data_len, ), - 3 => wire__crate__api__rhttp__client__client_settings_default_impl( + 4 => wire__crate__api__rhttp__client__client_settings_default_impl( port, ptr, rust_vec_len, data_len, ), - 4 => wire__crate__api__rhttp__http__make_http_request_receive_stream_impl( + 7 => wire__crate__api__rhttp__http__make_http_request_receive_stream_impl( port, ptr, rust_vec_len, data_len, ), - 6 => wire__crate__api__rhttp__http__register_client_impl(port, ptr, rust_vec_len, data_len), + 9 => wire__crate__api__rhttp__http__register_client_impl(port, ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -1034,8 +1311,18 @@ fn pde_ffi_dispatcher_sync_impl( ) -> flutter_rust_bridge::for_generated::WireSyncRust2DartSse { // Codec=Pde (Serialization + dispatch), see doc to use other codecs match func_id { - 5 => wire__crate__api__image__process_crop_image_impl(ptr, rust_vec_len, data_len), - 7 => wire__crate__api__rhttp__http__register_client_sync_impl(ptr, rust_vec_len, data_len), + 5 => wire__crate__api__rhttp__client__create_dynamic_resolver_sync_impl( + ptr, + rust_vec_len, + data_len, + ), + 6 => wire__crate__api__rhttp__client__create_static_resolver_sync_impl( + ptr, + rust_vec_len, + data_len, + ), + 8 => wire__crate__api__image__process_crop_image_impl(ptr, rust_vec_len, data_len), + 10 => wire__crate__api__rhttp__http__register_client_sync_impl(ptr, rust_vec_len, data_len), _ => unreachable!(), } } @@ -1057,6 +1344,21 @@ impl flutter_rust_bridge::IntoIntoDart> for Cancel } } +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self.0) + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive for FrbWrapper {} + +impl flutter_rust_bridge::IntoIntoDart> for DnsSettings { + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} + // Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { @@ -1097,12 +1399,12 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { [ - self.timeout.into_into_dart().into_dart(), - self.connect_timeout.into_into_dart().into_dart(), + self.timeout_settings.into_into_dart().into_dart(), self.throw_on_status_code.into_into_dart().into_dart(), self.proxy_settings.into_into_dart().into_dart(), self.redirect_settings.into_into_dart().into_dart(), self.tls_settings.into_into_dart().into_dart(), + self.dns_settings.into_into_dart().into_dart(), ] .into_dart() } @@ -1119,6 +1421,27 @@ impl flutter_rust_bridge::IntoIntoDart flutter_rust_bridge::for_generated::DartAbi { + [ + self.url.into_into_dart().into_dart(), + self.condition.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::rhttp::client::CustomProxy +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::rhttp::client::CustomProxy +{ + fn into_into_dart(self) -> crate::api::rhttp::client::CustomProxy { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::api::rhttp::http::HttpHeaders { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { match self { @@ -1248,11 +1571,38 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::rhttp::client::ProxyCondition { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + match self { + Self::Http => 0.into_dart(), + Self::Https => 1.into_dart(), + Self::All => 2.into_dart(), + _ => unreachable!(), + } + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::rhttp::client::ProxyCondition +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::rhttp::client::ProxyCondition +{ + fn into_into_dart(self) -> crate::api::rhttp::client::ProxyCondition { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::api::rhttp::client::ProxySettings { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { match self { - Self::NoProxy => 0.into_dart(), - _ => unreachable!(), + crate::api::rhttp::client::ProxySettings::NoProxy => [0.into_dart()].into_dart(), + crate::api::rhttp::client::ProxySettings::CustomProxyList(field0) => { + [1.into_dart(), field0.into_into_dart().into_dart()].into_dart() + } + _ => { + unimplemented!(""); + } } } } @@ -1333,6 +1683,50 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::rhttp::client::StaticDnsSettings { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.overrides.into_into_dart().into_dart(), + self.fallback.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::rhttp::client::StaticDnsSettings +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::rhttp::client::StaticDnsSettings +{ + fn into_into_dart(self) -> crate::api::rhttp::client::StaticDnsSettings { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for crate::api::rhttp::client::TimeoutSettings { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.timeout.into_into_dart().into_dart(), + self.connect_timeout.into_into_dart().into_dart(), + self.keep_alive_timeout.into_into_dart().into_dart(), + self.keep_alive_ping.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for crate::api::rhttp::client::TimeoutSettings +{ +} +impl flutter_rust_bridge::IntoIntoDart + for crate::api::rhttp::client::TimeoutSettings +{ + fn into_into_dart(self) -> crate::api::rhttp::client::TimeoutSettings { + self + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::api::rhttp::client::TlsSettings { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -1400,6 +1794,13 @@ impl SseEncode for CancellationToken { } } +impl SseEncode for DnsSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, MoiArc<_>>(self), serializer); + } +} + impl SseEncode for RequestClient { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1432,6 +1833,13 @@ impl SseEncode for std::collections::HashMap { } } +impl SseEncode for std::collections::HashMap> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + )>>::sse_encode(self.into_iter().collect(), serializer); + } +} + impl SseEncode for RustOpaqueMoi> { @@ -1443,6 +1851,17 @@ impl SseEncode } } +impl SseEncode + for RustOpaqueMoi> +{ + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + let (ptr, size) = self.sse_encode_raw(); + ::sse_encode(ptr, serializer); + ::sse_encode(size, serializer); + } +} + impl SseEncode for RustOpaqueMoi> { @@ -1486,8 +1905,10 @@ impl SseEncode for crate::api::rhttp::client::ClientCertificate { impl SseEncode for crate::api::rhttp::client::ClientSettings { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { - >::sse_encode(self.timeout, serializer); - >::sse_encode(self.connect_timeout, serializer); + >::sse_encode( + self.timeout_settings, + serializer, + ); ::sse_encode(self.throw_on_status_code, serializer); >::sse_encode( self.proxy_settings, @@ -1498,6 +1919,15 @@ impl SseEncode for crate::api::rhttp::client::ClientSettings { serializer, ); >::sse_encode(self.tls_settings, serializer); + >::sse_encode(self.dns_settings, serializer); + } +} + +impl SseEncode for crate::api::rhttp::client::CustomProxy { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.url, serializer); + ::sse_encode(self.condition, serializer); } } @@ -1617,6 +2047,26 @@ impl SseEncode for isize { } } +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1637,6 +2087,16 @@ impl SseEncode for Vec { } } +impl SseEncode for Vec<(String, Vec)> { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + <(String, Vec)>::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec<(String, String)> { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1657,6 +2117,26 @@ impl SseEncode for Option> { } } +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + impl SseEncode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1717,6 +2197,16 @@ impl SseEncode for Option { } } +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + impl SseEncode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1757,12 +2247,14 @@ impl SseEncode for Option> { } } -impl SseEncode for crate::api::rhttp::client::ProxySettings { +impl SseEncode for crate::api::rhttp::client::ProxyCondition { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { ::sse_encode( match self { - crate::api::rhttp::client::ProxySettings::NoProxy => 0, + crate::api::rhttp::client::ProxyCondition::Http => 0, + crate::api::rhttp::client::ProxyCondition::Https => 1, + crate::api::rhttp::client::ProxyCondition::All => 2, _ => { unimplemented!(""); } @@ -1772,6 +2264,32 @@ impl SseEncode for crate::api::rhttp::client::ProxySettings { } } +impl SseEncode for crate::api::rhttp::client::ProxySettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + match self { + crate::api::rhttp::client::ProxySettings::NoProxy => { + ::sse_encode(0, serializer); + } + crate::api::rhttp::client::ProxySettings::CustomProxyList(field0) => { + ::sse_encode(1, serializer); + >::sse_encode(field0, serializer); + } + _ => { + unimplemented!(""); + } + } + } +} + +impl SseEncode for (String, Vec) { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.0, serializer); + >::sse_encode(self.1, serializer); + } +} + impl SseEncode for (String, String) { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1836,6 +2354,24 @@ impl SseEncode for crate::api::rhttp::error::RhttpError { } } +impl SseEncode for crate::api::rhttp::client::StaticDnsSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >>::sse_encode(self.overrides, serializer); + >::sse_encode(self.fallback, serializer); + } +} + +impl SseEncode for crate::api::rhttp::client::TimeoutSettings { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.timeout, serializer); + >::sse_encode(self.connect_timeout, serializer); + >::sse_encode(self.keep_alive_timeout, serializer); + >::sse_encode(self.keep_alive_ping, serializer); + } +} + impl SseEncode for crate::api::rhttp::client::TlsSettings { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -1936,6 +2472,20 @@ mod io { MoiArc::>::decrement_strong_count(ptr as _); } + #[no_mangle] + pub extern "C" fn frbgen_mangayomi_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::increment_strong_count(ptr as _); + } + + #[no_mangle] + pub extern "C" fn frbgen_mangayomi_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::decrement_strong_count(ptr as _); + } + #[no_mangle] pub extern "C" fn frbgen_mangayomi_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( ptr: *const std::ffi::c_void, @@ -1990,6 +2540,20 @@ mod web { MoiArc::>::decrement_strong_count(ptr as _); } + #[wasm_bindgen] + pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::increment_strong_count(ptr as _); + } + + #[wasm_bindgen] + pub fn rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings( + ptr: *const std::ffi::c_void, + ) { + MoiArc::>::decrement_strong_count(ptr as _); + } + #[wasm_bindgen] pub fn rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient( ptr: *const std::ffi::c_void,