getConnectionStats method
Get current connection statistics
Implementation
@override
Future<SingBoxConnectionStats> getConnectionStats() async {
try {
final statsMap = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
'getConnectionStats',
);
if (statsMap != null) {
return SingBoxConnectionStats.fromMap(statsMap);
}
return const SingBoxConnectionStats(
downloadSpeed: 0,
uploadSpeed: 0,
bytesSent: 0,
bytesReceived: 0,
connectionDuration: 0,
);
} catch (e) {
debugPrint('Error getting connection stats: $e');
return const SingBoxConnectionStats(
downloadSpeed: 0,
uploadSpeed: 0,
bytesSent: 0,
bytesReceived: 0,
connectionDuration: 0,
);
}
}