public class ModuleLoader
extends java.lang.Object
Constructor and Description |
---|
ModuleLoader(android.content.Context context,
RootShell rootShell,
java.lang.String userAgent)
Public constructor for ModuleLoader
|
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
download()
Download the correct WireGuard module for the device
|
static boolean |
isModuleLoaded()
Check whether a WireGuard module is already loaded into the kernel.
|
void |
loadModule()
Load the downloaded module.
|
boolean |
moduleMightExist()
Check if the module might already exist in the app's data.
|
public ModuleLoader(android.content.Context context, RootShell rootShell, java.lang.String userAgent)
context
- A Context
instance.rootShell
- A RootShell
instance used to run elevated commands required for module
loading.userAgent
- A String
that represents the User-Agent string used for connections
to the upstream server.public static boolean isModuleLoaded()
public java.lang.Integer download() throws java.io.IOException, RootShell.RootShellException, java.security.NoSuchAlgorithmException
OsConstants
.EXIT_SUCCESS if everything succeeds, ENOENT otherwise.java.io.IOException
- if the remote hash list was not found or empty.RootShell.RootShellException
- if RootShell
has a failure executing elevated commands.java.security.NoSuchAlgorithmException
- if SHA256 algorithm is not available in device JDK.public void loadModule() throws java.io.IOException, RootShell.RootShellException
java.io.IOException
- if RootShell
has a failure executing elevated commands.RootShell.RootShellException
- if RootShell
has a failure executing elevated commands.public boolean moduleMightExist()