Interface Backend

  • All Known Implementing Classes:
    GoBackend, WgQuickBackend

    public interface Backend
    Interface for implementations of the WireGuard secure network tunnel.
    • Method Detail

      • getRunningTunnelNames

        java.util.Set<java.lang.String> getRunningTunnelNames()
        Enumerate names of currently-running tunnels.
        Returns:
        The set of running tunnel names.
      • getState

        Tunnel.State getState​(Tunnel tunnel)
                       throws java.lang.Exception
        Get the state of a tunnel.
        Parameters:
        tunnel - The tunnel to examine the state of.
        Returns:
        The state of the tunnel.
        Throws:
        java.lang.Exception - Exception raised when retrieving tunnel's state.
      • getStatistics

        Statistics getStatistics​(Tunnel tunnel)
                          throws java.lang.Exception
        Get statistics about traffic and errors on this tunnel. If the tunnel is not running, the statistics object will be filled with zero values.
        Parameters:
        tunnel - The tunnel to retrieve statistics for.
        Returns:
        The statistics for the tunnel.
        Throws:
        java.lang.Exception - Exception raised when retrieving statistics.
      • getVersion

        java.lang.String getVersion()
                             throws java.lang.Exception
        Determine version of underlying backend.
        Returns:
        The version of the backend.
        Throws:
        java.lang.Exception - Exception raised while retrieving version.
      • setState

        Tunnel.State setState​(Tunnel tunnel,
                              Tunnel.State state,
                              @Nullable
                              Config config)
                       throws java.lang.Exception
        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.
        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:
        The updated state of the tunnel.
        Throws:
        java.lang.Exception - Exception raised while changing state.