Class Network

  • All Implemented Interfaces:

    
    public class Network
    
                        
    • Method Detail

      • svrB

         SvrB svrB(String username, String password)

        Get the SVR-B (Secure Value Recovery for Backups) service for this network instance.

        Parameters:
        username - The username for authenticating with the SVR-B service.
        password - The password for authenticating with the SVR-B service.
        Returns:

        An SvrB service instance configured for this network environment.

      • setProxy

         void setProxy(String scheme, String host, Integer port, String username, String password)

        Sets the proxy host to be used for all new connections (until overridden).

        Sets a server to be used to proxy all new outgoing connections. The proxy can be overridden by calling this method again or unset by calling clearProxy. Passing null for the port means the default port for the scheme will be used. username and password can be null as well.

        To specify a Signal transparent TLS proxy, use SIGNAL_TLS_PROXY_SCHEME, or the overload that takes a separate domain and port number.

        Existing connections and services will continue with the setting they were created with. (In particular, changing this setting will not affect any existing ChatConnections.)

      • setProxy

         void setProxy(String host, int port)

        Sets the Signal TLS proxy host to be used for all new connections (until overridden).

        Sets a domain name and port to be used to proxy all new outgoing connections, using a Signal transparent TLS proxy. The proxy can be overridden by calling this method again or unset by calling clearProxy.

        Existing connections and services will continue with the setting they were created with. (In particular, changing this setting will not affect any existing ChatConnections.)

      • setInvalidProxy

         void setInvalidProxy()

        Refuses to make any new connections until a new proxy configuration is set or clearProxy is called.

        Existing connections will not be affected.

      • clearProxy

         void clearProxy()

        Ensures that future connections will be made directly, not through a proxy.

        Clears any proxy configuration set via setProxy or setInvalidProxy. If none was set, calling this method is a no-op.

        Existing connections and services will continue with the setting they were created with. (In particular, changing this setting will not affect any existing ChatConnections.)

      • setCensorshipCircumventionEnabled

         void setCensorshipCircumventionEnabled(boolean enabled)

        Enables or disables censorship circumvention for all new connections (until changed).

        If CC is enabled, new connections and services may try additional routes to the Signal servers. Existing connections and services will continue with the setting they were created with. (In particular, changing this setting will not affect any existing ChatConnections.)

        CC is off by default.

      • setRemoteConfig

         void setRemoteConfig(Map<String, String> remoteConfig)

        Updates libsignal's remote configuration settings.

        The provided configuration map must conform to the following requirements:

        • Each key represents an enabled configuration and directly indicates that the setting is enabled.
        • Keys must have had the platform-specific prefix (e.g., "android.libsignal.") removed.
        • Entries explicitly disabled by the server must not appear in the map.
        • Values originally set to null by the server must be represented as empty strings.
        • Values should otherwise maintain the same format as they are returned by the server.

        These constraints ensure configurations passed to libsignal precisely reflect enabled server-provided settings, without ambiguity.

        Only new connections made *after* this call will use the new remote config settings. Existing connections are not affected.

        Parameters:
        remoteConfig - a map containing preprocessed libsignal configuration keys and their associated values
      • onNetworkChange

         void onNetworkChange()

        Notifies libsignal that the network has changed.

        This will lead to, e.g. caches being cleared and cooldowns being reset.

      • checkClassesCanBeLoadedAsyncForTest

         static void checkClassesCanBeLoadedAsyncForTest()

        Try to load several libsignal classes asynchronously, using the same mechanism as native (Rust) code.

        This should only be called in tests, and can be used to ensure at test time that libsignal async code won't fail to load exceptions.

      • preconnectChat

         CompletableFuture<Void> preconnectChat()

        Starts the process of connecting to the chat server.

        If this completes successfully, the next call to connectAuthChat may be able to finish more quickly. If it's incomplete or produces an error, such a call will start from scratch as usual. Only one preconnect is recorded, so there's no point in calling this more than once.