connectIkev2EAP method

  1. @override
Future<void> connectIkev2EAP({
  1. required String server,
  2. required String username,
  3. required String password,
  4. String? name,
  5. int? mtu,
  6. int? port,
  7. String? remoteId,
  8. String? localId,
  9. bool disableCertValidation = false,
})
override

Connect to VPN. (IKEv2-EAP)

This will create a background VPN service. MTU is only available on android.

Implementation

@override
Future<void> connectIkev2EAP({
  required String server,
  required String username,
  required String password,
  String? name,
  int? mtu,
  int? port,
  String? remoteId,
  String? localId,
  bool disableCertValidation = false,
}) async =>
    await methodChannel.invokeMethod('connect', {
      'Type': 'IKEv2',
      'Server': server,
      'Username': username,
      'Password': password,
      'Secret': '',
      'Name': name ?? server,
      if (mtu != null) 'mtu': mtu,
      if (port != null) 'port': port,
      if (remoteId != null) 'RemoteId': remoteId,
      if (localId != null) 'LocalId': localId,
      // Since we are adding logic to support disabling certificate validation, we'll pass a flag.
      // However, the native Android code currently doesn't check this flag directly in the initial connect arguments
      // unless we modify CharonVpnService/VpnProfile to respect it.
      // NOTE: The user's logs indicate "no trusted RSA public key found".
      // Disabling cert validation usually means setting flags in VpnProfile.
      // For now, let's pass it. I will need to update the Kotlin side to read this.
      'DisableCertValidation': disableCertValidation,
    });