net
ModuleNetwork helpers: inet_pton/inet_ntop.
PHP's address functions call the C library; the dev image is Alpine, so
these are ports of musl's inet_pton/inet_ntop (src/network/), whose
IPv6 formatting differs from glibc's in which zero run it compresses.
Contents
use utopia_php_std::net::NulByteError;Rust
pub struct NulByteError {
// private fields
}PHP's ValueError for a string argument that must not contain NUL bytes
(Z_PARAM_PATH): "<function>(): Argument #1 ($ip) must not contain any null bytes".
Also implements
Display.use utopia_php_std::net::PackedAddr;Rust
pub enum PackedAddr {
V4([u8; 4]),
V6([u8; 16]),
}A packed address from inet_pton.
use utopia_php_std::net::inet_ntop;Rust
pub fn inet_ntop(packed: &[u8]) -> Option<String>PHP inet_ntop($ip): a 4-byte (IPv4) or 16-byte (IPv6) packed address
in text form; None (PHP's false) for any other length.
use utopia_php_std::net::inet_pton;Rust
pub fn inet_pton(ip: &[u8]) -> Result<Option<PackedAddr>, NulByteError>PHP inet_pton($ip): IPv6 when the string contains :, IPv4 when it
contains ., None (PHP's false) otherwise or when invalid.