waft.warp_client.warp_client_handler module

class waft.warp_client.warp_client_handler.WarpClientHandler(node: BaseNode)

Bases: ABC

Base Class for WARP client handler. Will contain all platform agnostic logic and actions.

app_data_path: PurePath
capture_warp_diag() Path | PurePath

Generates a warp-diag output file and optionally exports it to the local filesystem based on configuration setting DOWNLOAD_WARP_DIAG.

Returns:

Local or remote warp-diag archive file path

Return type:

Path | PurePath

generate_warp_diag(output_path: PurePath | None = None, comment: str | None = None, enable_all_routes: bool = False, verbosity: int = 0) PurePath

Execute warp-diag command with given parameters and output to the given path

Parameters:
  • output_path – Path on node where log should be dumped, Defaults to node temp directory

  • comment – Add a note to your logs

  • enable_all_routes – Test an IP address for all included or excluded ranges. This option will make diagnostics collection take longer, but will include more helpful information

  • verbosity – Number of ‘v’s to include to increase verbosity of logging in warp-diag

abstractmethod get_warp_dns_mode() str

Get the current WARP DNS resolution mode

abstract property install_manager: InstallManagerBase

Returns an install manager instance

mdm: WarpMDMHandler
node: BaseNode
perform_email_enrollment(organization: TrmOrganization)

Once registration creation flow has been started this method will perform the necessary steps to complete enrollment

Parameters:

organization – Name of organization for node to enroll in

read_registration_cache(json_file: str) dict

Read a cached WARP registration JSON file.

Parameters:

json_file (str) – Name of a JSON file within the WARP application data path

Returns:

JSON-formatted WARP registration cached content

Return type:

dict

read_registration_secret() dict

Read the stored WARP registration secret details.

Returns:

JSON-formatted WARP registration secret details

Return type:

dict

save_warp_diag(output_path: Path | None = None, **kwargs) Path

Initiates collection of warp-diag on node and then downloads file to local filesystem

Args: output_path: Location that warp-diag zip shall be copied to on local system **kwargs: Optional keyword arguments to pass to the generate_warp_diag method

set_cf_warp_api(zero_trust: bool)

Set CF_WARP_API to redirect WARP client service API calls

Parameters:

zero_trust (bool) – True if running in ZeroTrust mode

set_rust_backtrace()

Set RUST_BACKTRACE to full for better debugging in the case of a daemon panic

set_service_environment_variable(variable: str, value: str | int)

Set Environment variable for the WARP client service

Parameters:
  • variable – name of the environment variable to set

  • value – Value to which to set the environment variable

abstractmethod tunnel_connected() bool

Check to see if WARP is routing the connection through the tunnel

abstract property warp_cli: WarpCliBase

Returns a WarpCli instance for the appropriate node

warp_diag_bin: str = 'warp-diag'
warp_dns_domain: str = 'check.cloudflareresolve.com'
warp_inside_tunnel_ip: str = '162.159.197.4'