import 'dart:io'; import 'package:fpdart/fpdart.dart'; import 'package:hiddify/domain/connectivity/connectivity.dart'; import 'package:hiddify/domain/singbox/singbox.dart'; import 'package:hiddify/services/singbox/ffi_singbox_service.dart'; import 'package:hiddify/services/singbox/mobile_singbox_service.dart'; abstract interface class SingboxService { factory SingboxService() { if (Platform.isAndroid) { return MobileSingboxService(); } else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { return FFISingboxService(); } throw Exception("unsupported platform"); } Future init(); TaskEither setup( String baseDir, String workingDir, String tempDir, ); TaskEither parseConfig(String path); TaskEither changeConfigOptions(ConfigOptions options); TaskEither start(String configPath); TaskEither stop(); TaskEither restart(String configPath); Stream watchOutbounds(); TaskEither selectOutbound(String groupTag, String outboundTag); TaskEither urlTest(String groupTag); Stream watchConnectionStatus(); Stream watchStats(); Stream watchLogs(String path); }