connect method

void connect(
  1. String config,
  2. String name, {
  3. String? username,
  4. String? password,
  5. List<String>? bypassPackages,
  6. bool certIsRequired = false,
})

Connect to VPN

config : Your openvpn configuration script, you can find it inside your .ovpn file

name : name that will show in user's notification

certIsRequired : default is false, if your config file has cert, set it to true

username & password : set your username and password if your config file has auth-user-pass

bypassPackages : exclude some apps to access/use the VPN Connection, it was List

Implementation

void connect(String config, String name,
    {String? username,
    String? password,
    List<String>? bypassPackages,
    bool certIsRequired = false}) async {
  if (!initialized) throw ("OpenVPN need to be initialized");
  if (!certIsRequired) config += "client-cert-not-required";
  _tempDateTime = DateTime.now();
  _channelControl.invokeMethod("connect", {
    "config": config,
    "name": name,
    "username": username,
    "password": password,
    "bypass_packages": bypassPackages ?? []
  });
}