Modifier and Type | Class and Description |
---|---|
static interface |
GoBackend.AlwaysOnCallback
Callback for
GoBackend that is invoked when GoBackend.VpnService is started by the
system's Always-On VPN mode. |
static class |
GoBackend.VpnService
VpnService implementation for GoBackend |
Constructor and Description |
---|
GoBackend(android.content.Context context)
Public constructor for GoBackend.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.lang.String> |
getRunningTunnelNames()
Method to get the names of running tunnels.
|
Tunnel.State |
getState(Tunnel tunnel)
Get the associated
Tunnel.State for a given Tunnel . |
Statistics |
getStatistics(Tunnel tunnel)
Get the associated
Statistics for a given Tunnel . |
java.lang.String |
getVersion()
Get the version of the underlying wireguard-go library.
|
static void |
setAlwaysOnCallback(GoBackend.AlwaysOnCallback cb)
Set a
GoBackend.AlwaysOnCallback to be invoked when GoBackend.VpnService is started by the
system's Always-On VPN mode. |
Tunnel.State |
setState(Tunnel tunnel,
Tunnel.State state,
Config config)
|
public GoBackend(android.content.Context context)
context
- An Android Context
public static void setAlwaysOnCallback(GoBackend.AlwaysOnCallback cb)
GoBackend.AlwaysOnCallback
to be invoked when GoBackend.VpnService
is started by the
system's Always-On VPN mode.cb
- Callback to be invokedpublic java.util.Set<java.lang.String> getRunningTunnelNames()
getRunningTunnelNames
in interface Backend
public Tunnel.State getState(Tunnel tunnel)
Tunnel.State
for a given Tunnel
.getState
in interface Backend
tunnel
- The tunnel to examine the state of.Tunnel.State
associated with the given tunnel.public Statistics getStatistics(Tunnel tunnel)
Statistics
for a given Tunnel
.getStatistics
in interface Backend
tunnel
- The tunnel to retrieve statistics for.Statistics
associated with the given tunnel.public java.lang.String getVersion()
getVersion
in interface Backend
String
value of the version of the wireguard-go library.public Tunnel.State setState(Tunnel tunnel, Tunnel.State state, @Nullable Config config) throws java.lang.Exception
setState
in interface Backend
tunnel
- The tunnel to control the state of.state
- The new state for this tunnel. Must be UP
, DOWN
, or
TOGGLE
.config
- The configuration for this tunnel, may be null if state is DOWN
.Tunnel.State
of the tunnel after state changes are applied.java.lang.Exception
- Exception raised while changing tunnel state.