Class GoBackend

  • All Implemented Interfaces:
    Backend

    public final class GoBackend
    extends java.lang.Object
    implements Backend
    Implementation of Backend that uses the wireguard-go userspace implementation to provide WireGuard tunnels.
    • Constructor Detail

      • GoBackend

        public GoBackend​(android.content.Context context)
        Public constructor for GoBackend.
        Parameters:
        context - An Android Context
    • Method Detail

      • getRunningTunnelNames

        public java.util.Set<java.lang.String> getRunningTunnelNames()
        Method to get the names of running tunnels.
        Specified by:
        getRunningTunnelNames in interface Backend
        Returns:
        A set of string values denoting names of running tunnels.
      • getVersion

        public java.lang.String getVersion()
        Get the version of the underlying wireguard-go library.
        Specified by:
        getVersion in interface Backend
        Returns:
        String value of the version of the wireguard-go library.
      • setState

        public Tunnel.State setState​(Tunnel tunnel,
                                     Tunnel.State state,
                                     @Nullable
                                     Config config)
                              throws java.lang.Exception
        Change the state of a given Tunnel, optionally applying a given Config.
        Specified by:
        setState in interface Backend
        Parameters:
        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.
        Returns:
        Tunnel.State of the tunnel after state changes are applied.
        Throws:
        java.lang.Exception - Exception raised while changing tunnel state.