Add tun implementation option
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -19,10 +19,11 @@ class ConfigOptions with _$ConfigOptions {
|
||||
@Default(DomainStrategy.auto) DomainStrategy directDnsDomainStrategy,
|
||||
@Default(2334) int mixedPort,
|
||||
@Default(6450) int localDnsPort,
|
||||
@Default(TunImplementation.mixed) TunImplementation tunImplementation,
|
||||
@Default(9000) int mtu,
|
||||
@Default("https://www.gstatic.com/generate_204") String connectionTestUrl,
|
||||
@IntervalConverter()
|
||||
@Default(Duration(minutes: 5))
|
||||
@Default(Duration(minutes: 10))
|
||||
Duration urlTestInterval,
|
||||
@Default(true) bool enableClashApi,
|
||||
@Default(9090) int clashApiPort,
|
||||
@@ -83,6 +84,12 @@ enum DomainStrategy {
|
||||
};
|
||||
}
|
||||
|
||||
enum TunImplementation {
|
||||
mixed,
|
||||
system,
|
||||
gVisor;
|
||||
}
|
||||
|
||||
class IntervalConverter implements JsonConverter<Duration, String> {
|
||||
const IntervalConverter();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user