Package com.wireguard.android.backend
Class WgQuickBackend
- java.lang.Object
-
- com.wireguard.android.backend.WgQuickBackend
-
-
Constructor Summary
Constructors Constructor Description WgQuickBackend(android.content.Context context, RootShell rootShell, ToolsInstaller toolsInstaller)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>getRunningTunnelNames()Enumerate names of currently-running tunnels.Tunnel.StategetState(Tunnel tunnel)Get the state of a tunnel.StatisticsgetStatistics(Tunnel tunnel)Get statistics about traffic and errors on this tunnel.java.lang.StringgetVersion()Determine version of underlying backend.static booleanhasKernelSupport()voidsetMultipleTunnels(boolean on)Tunnel.StatesetState(Tunnel tunnel, Tunnel.State state, Config config)Set the state of a tunnel, updating it's configuration.
-
-
-
Constructor Detail
-
WgQuickBackend
public WgQuickBackend(android.content.Context context, RootShell rootShell, ToolsInstaller toolsInstaller)
-
-
Method Detail
-
hasKernelSupport
public static boolean hasKernelSupport()
-
getRunningTunnelNames
public java.util.Set<java.lang.String> getRunningTunnelNames()
Description copied from interface:BackendEnumerate names of currently-running tunnels.- Specified by:
getRunningTunnelNamesin interfaceBackend- Returns:
- The set of running tunnel names.
-
getState
public Tunnel.State getState(Tunnel tunnel)
Description copied from interface:BackendGet the state of a tunnel.
-
getStatistics
public Statistics getStatistics(Tunnel tunnel)
Description copied from interface:BackendGet statistics about traffic and errors on this tunnel. If the tunnel is not running, the statistics object will be filled with zero values.- Specified by:
getStatisticsin interfaceBackend- Parameters:
tunnel- The tunnel to retrieve statistics for.- Returns:
- The statistics for the tunnel.
-
getVersion
public java.lang.String getVersion() throws java.lang.ExceptionDescription copied from interface:BackendDetermine version of underlying backend.- Specified by:
getVersionin interfaceBackend- Returns:
- The version of the backend.
- Throws:
java.lang.Exception- Exception raised while retrieving version.
-
setMultipleTunnels
public void setMultipleTunnels(boolean on)
-
setState
public Tunnel.State setState(Tunnel tunnel, Tunnel.State state, @Nullable Config config) throws java.lang.Exception
Description copied from interface:BackendSet the state of a tunnel, updating it's configuration. If the tunnel is already up, config may update the running configuration; config may be null when setting the tunnel down.- Specified by:
setStatein interfaceBackend- Parameters:
tunnel- The tunnel to control the state of.state- The new state for this tunnel. Must beUP,DOWN, orTOGGLE.config- The configuration for this tunnel, may be null if state isDOWN.- Returns:
- The updated state of the tunnel.
- Throws:
java.lang.Exception- Exception raised while changing state.
-
-