import 'dart:io'; import 'package:fpdart/fpdart.dart'; import 'package:hiddify/core/model/directories.dart'; import 'package:hiddify/singbox/model/singbox_config_option.dart'; import 'package:hiddify/singbox/model/singbox_outbound.dart'; import 'package:hiddify/singbox/model/singbox_stats.dart'; import 'package:hiddify/singbox/model/singbox_status.dart'; import 'package:hiddify/singbox/service/ffi_singbox_service.dart'; import 'package:hiddify/singbox/service/platform_singbox_service.dart'; abstract interface class SingboxService { factory SingboxService() { if (Platform.isAndroid || Platform.isIOS) { return PlatformSingboxService(); } else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { return FFISingboxService(); } throw Exception("unsupported platform"); } Future init(); TaskEither setup( Directories directories, bool debug, ); TaskEither validateConfigByPath( String path, String tempPath, bool debug, ); TaskEither changeOptions(SingboxConfigOption options); TaskEither generateFullConfigByPath( String path, ); TaskEither start( String path, String name, bool disableMemoryLimit, ); TaskEither stop(); TaskEither restart( String path, String name, bool disableMemoryLimit, ); Stream> watchOutbounds(); TaskEither selectOutbound(String groupTag, String outboundTag); TaskEither urlTest(String groupTag); Stream watchStatus(); Stream watchStats(); Stream> watchLogs(String path); TaskEither clearLogs(); }