Function parseIp [src]
Parse the given IP address string into an Address value.
It is recommended to use resolveIp instead, to handle
IPv6 link-local unix addresses.
Prototype
pub fn parseIp(name: []const u8, port: u16) !Address
Parameters
name: []const u8
port: u16
Source
pub fn parseIp(name: []const u8, port: u16) !Address {
if (parseIp4(name, port)) |ip4| return ip4 else |err| switch (err) {
error.Overflow,
error.InvalidEnd,
error.InvalidCharacter,
error.Incomplete,
error.NonCanonical,
=> {},
}
if (parseIp6(name, port)) |ip6| return ip6 else |err| switch (err) {
error.Overflow,
error.InvalidEnd,
error.InvalidCharacter,
error.Incomplete,
error.InvalidIpv4Mapping,
=> {},
}
return error.InvalidIPAddressFormat;
}