Function initPosix [src]
Asserts that addr is an IP address.
This function will read past the end of the pointer, with a size depending
on the address family.
Prototype
pub fn initPosix(addr: *align(4) const posix.sockaddr) Address
Parameters
addr: *align(4) const posix.sockaddr
Source
pub fn initPosix(addr: *align(4) const posix.sockaddr) Address {
switch (addr.family) {
posix.AF.INET => return Address{ .in = Ip4Address{ .sa = @as(*const posix.sockaddr.in, @ptrCast(addr)).* } },
posix.AF.INET6 => return Address{ .in6 = Ip6Address{ .sa = @as(*const posix.sockaddr.in6, @ptrCast(addr)).* } },
else => unreachable,
}
}