Add tun implementation option

This commit is contained in:
problematicconsumer
2023-09-05 19:04:46 +03:30
parent 182a153955
commit 2d9b475034
3 changed files with 16 additions and 1 deletions

View File

@@ -42,6 +42,12 @@ final directDnsDomainStrategyStore = PrefNotifier.provider(
final mixedPortStore = PrefNotifier.provider("mixed-port", _default.mixedPort);
final localDnsPortStore =
PrefNotifier.provider("localDns-port", _default.localDnsPort);
final tunImplementationStore = PrefNotifier.provider(
"tun-implementation",
_default.tunImplementation,
mapFrom: TunImplementation.values.byName,
mapTo: (value) => value.name,
);
final mtuStore = PrefNotifier.provider("mtu", _default.mtu);
final connectionTestUrlStore =
PrefNotifier.provider("connection-test-url", _default.connectionTestUrl);
@@ -67,6 +73,7 @@ ConfigOptions configOptions(ConfigOptionsRef ref) => ConfigOptions(
directDnsDomainStrategy: ref.watch(directDnsDomainStrategyStore),
mixedPort: ref.watch(mixedPortStore),
localDnsPort: ref.watch(localDnsPortStore),
tunImplementation: ref.watch(tunImplementationStore),
mtu: ref.watch(mtuStore),
connectionTestUrl: ref.watch(connectionTestUrlStore),
urlTestInterval: ref.watch(urlTestIntervalStore),

View File

@@ -78,6 +78,7 @@ class CoreFacadeImpl with ExceptionHandler, InfraLogger implements CoreFacade {
) {
return exceptionHandler(
() {
loggy.debug("changing config options: $options");
return singbox
.changeConfigOptions(options)
.mapLeft(CoreServiceFailure.invalidConfigOptions)