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.State
getState(Tunnel tunnel)
Get the state of a tunnel.Statistics
getStatistics(Tunnel tunnel)
Get statistics about traffic and errors on this tunnel.java.lang.String
getVersion()
Determine version of underlying backend.static boolean
hasKernelSupport()
void
setMultipleTunnels(boolean on)
Tunnel.State
setState(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:Backend
Enumerate names of currently-running tunnels.- Specified by:
getRunningTunnelNames
in interfaceBackend
- Returns:
- The set of running tunnel names.
-
getState
public Tunnel.State getState(Tunnel tunnel)
Description copied from interface:Backend
Get the state of a tunnel.
-
getStatistics
public Statistics getStatistics(Tunnel tunnel)
Description copied from interface:Backend
Get 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:
getStatistics
in interfaceBackend
- Parameters:
tunnel
- The tunnel to retrieve statistics for.- Returns:
- The statistics for the tunnel.
-
getVersion
public java.lang.String getVersion() throws java.lang.Exception
Description copied from interface:Backend
Determine version of underlying backend.- Specified by:
getVersion
in 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:Backend
Set 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:
setState
in 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.
-
-