Crate pingap_util

Source

Structs§

IpRules
IpRules stores IP addresses and networks for access control

Enums§

Error
Error enum for various error types in the utility module

Functions§

aes_decrypt
Decrypts AES-256-GCM-SIV encrypted data using a static nonce.
aes_encrypt
Encrypts data using AES-256-GCM-SIV with a static nonce.
base64_decode
base64_encode
convert_certificate_bytes
Converts an optional certificate string into bytes. Handles PEM format, file paths, and base64-encoded data.
convert_pem
Converts various certificate/key formats into bytes. Supports PEM format, file paths, and base64-encoded data.
elapsed_ms
Returns the elapsed time in milliseconds since the given SystemTime
elapsed_second
Returns the elapsed time in seconds (as f64) since the given SystemTime
format_byte_size
Formats a byte size into a human readable string with appropriate units (B, KB, MB, GB) The function will add decimal points for values between units (e.g., 1.5KB)
format_duration
Formats a duration in milliseconds into a human readable string For durations < 1000ms, formats as milliseconds For durations >= 1000ms, formats as seconds with up to one decimal place
get_latency
Calculates latency between a previous timestamp and now If previous timestamp is None, returns current timestamp Returns: Some(latency in milliseconds) or Some(current timestamp) if input is None
get_pkg_version
Gets the package version.
get_rustc_version
Get the rustc version.
get_super_ts
Returns the number of seconds elapsed since SUPER_TIMESTAMP Returns 0 if the current time is before SUPER_TIMESTAMP
is_pem
Checks if a string represents a PEM-formatted certificate/key by looking for the “—–” prefix.
now
Returns the duration since UNIX epoch (1970-01-01 00:00:00 UTC)
now_ms
Returns the current timestamp in milliseconds since UNIX epoch
now_sec
Returns the current timestamp in seconds since UNIX epoch
path_join
Joins two path segments with a forward slash Handles cases where segments already include slashes
resolve_path
Resolves a path string to its absolute form. If the path starts with ‘~’, it will be expanded to the user’s home directory. Returns an empty string if the input path is empty.
toml_omit_empty_value
Removes empty tables/sections from a TOML string