Add warp config generator

This commit is contained in:
problematicconsumer
2024-02-18 12:35:11 +03:30
parent ce6ab59bf7
commit 33dc21918d
15 changed files with 459 additions and 973 deletions

View File

@@ -61,6 +61,8 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
@Default(false) bool enableWarp,
@Default(WarpDetourMode.outbound) WarpDetourMode warpDetourMode,
@Default("") String warpLicenseKey,
@Default("") String warpAccountId,
@Default("") String warpAccessToken,
@Default("auto") String warpCleanIp,
@Default(0) int warpPort,
@OptionalRangeJsonConverter()
@@ -133,6 +135,8 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
enableWarp: patch.enableWarp ?? enableWarp,
warpDetourMode: patch.warpDetourMode ?? warpDetourMode,
warpLicenseKey: patch.warpLicenseKey ?? warpLicenseKey,
warpAccountId: patch.warpAccountId ?? warpAccountId,
warpAccessToken: patch.warpAccessToken ?? warpAccessToken,
warpCleanIp: patch.warpCleanIp ?? warpCleanIp,
warpPort: patch.warpPort ?? warpPort,
warpNoise: patch.warpNoise ?? warpNoise,
@@ -183,6 +187,8 @@ class ConfigOptionEntity with _$ConfigOptionEntity {
enableWarp: enableWarp,
warpDetourMode: warpDetourMode,
warpLicenseKey: warpLicenseKey,
warpAccountId: warpAccountId,
warpAccessToken: warpAccessToken,
warpCleanIp: warpCleanIp,
warpPort: warpPort,
warpNoise: warpNoise,
@@ -237,6 +243,8 @@ class ConfigOptionPatch with _$ConfigOptionPatch {
bool? enableWarp,
WarpDetourMode? warpDetourMode,
String? warpLicenseKey,
String? warpAccountId,
String? warpAccessToken,
String? warpCleanIp,
int? warpPort,
@OptionalRangeJsonConverter() OptionalRange? warpNoise,

View File

@@ -14,6 +14,9 @@ sealed class ConfigOptionFailure with _$ConfigOptionFailure, Failure {
StackTrace? stackTrace,
]) = ConfigOptionUnexpectedFailure;
@With<ExpectedFailure>()
const factory ConfigOptionFailure.missingWarp() = MissingWarpConfigFailure;
@override
({String type, String? message}) present(TranslationsEn t) {
return switch (this) {
@@ -21,6 +24,10 @@ sealed class ConfigOptionFailure with _$ConfigOptionFailure, Failure {
type: t.failure.unexpected,
message: null,
),
MissingWarpConfigFailure() => (
type: t.settings.config.missingWarpConfig,
message: null,
),
};
}
}