isVpnActive method

  1. @override
Future<bool> isVpnActive()
override

Implementation

@override
Future<bool> isVpnActive() async {
  final interfaces = await NetworkInterface.list(
    includeLoopback: false,
    type: InternetAddressType.any,
  );

  if (interfaces.isEmpty) {
    return false;
  }

  return interfaces.any(
    (interface) =>
        _vpnNames.any((name) => interface.name.toLowerCase().contains(name)),
  );
}