Module utils

Module utils 

Source
Expand description

Network Utilities

This module provides common utility functions for network operations.

Functionsยง

exponential_backoff
Calculate exponential backoff duration
format_bandwidth
Format bytes per second in human-readable format (B/s, KB/s, MB/s, GB/s)
format_bytes
Format bytes in human-readable format (B, KB, MB, GB, TB)
format_duration
Format duration in human-readable format
is_local_addr
Check if a multiaddress is a local address (loopback or link-local)
is_public_addr
Check if a multiaddress is a public address
jittered_backoff
Calculate jittered exponential backoff duration
moving_average
Calculate moving average
parse_multiaddr
Parse a multiaddress string
parse_multiaddrs
Parse multiple multiaddress strings
peers_match
Check if two peer IDs match
percentage
Calculate percentage with proper rounding
truncate_peer_id
Truncate a peer ID for display purposes
validate_alpha
Validate alpha value for exponential moving average