new: add seperated VPN service mode

This commit is contained in:
Hiddify
2024-02-14 15:51:58 +01:00
parent 930959baf7
commit 382f4c7d5e
6 changed files with 19 additions and 13 deletions

View File

@@ -191,6 +191,7 @@ class SingBoxConfigOptionRepositoryImpl
enableClashApi: persisted.enableClashApi,
clashApiPort: persisted.clashApiPort,
enableTun: persisted.serviceMode == ServiceMode.tun,
enableTunService: persisted.serviceMode == ServiceMode.tunService,
setSystemProxy: persisted.serviceMode == ServiceMode.systemProxy,
bypassLan: persisted.bypassLan,
allowConnectionFromLan: persisted.allowConnectionFromLan,

View File

@@ -159,11 +159,11 @@ class ConnectionRepositoryImpl
await $(
TaskEither(() async {
if (options.enableTun) {
// final hasPrivilege = await platformSource.checkPrivilege();
// if (!hasPrivilege) {
// loggy.warning("missing privileges for tun mode");
// return left(const MissingPrivilege());
// }
final hasPrivilege = await platformSource.checkPrivilege();
if (!hasPrivilege) {
loggy.warning("missing privileges for tun mode");
return left(const MissingPrivilege());
}
}
return right(unit);
}),
@@ -192,11 +192,11 @@ class ConnectionRepositoryImpl
await $(
TaskEither(() async {
if (options.enableTun) {
// final hasPrivilege = await platformSource.checkPrivilege();
// if (!hasPrivilege) {
// loggy.warning("missing privileges for tun mode");
// return left(const MissingPrivilege());
// }
final hasPrivilege = await platformSource.checkPrivilege();
if (!hasPrivilege) {
loggy.warning("missing privileges for tun mode");
return left(const MissingPrivilege());
}
}
return right(unit);
}),