focus-ios
focus-ios copied to clipboard
Improve URLExtensions.isIPv4/isIPv6
In URLExtensions.swift
we have isIPv4
and isIPv6
functions. The first uses a regex and the second just checks for the presence of a :
in the string. Let's replace this with a call to inet_pton()
to let the OS parse the address instead - delegating to a trusted OS function will be more robust.
Example at https://stackoverflow.com/questions/35056268/how-to-use-swift-convert-string-to-ipv6-addr
As part of this work, let's also start a URLExtensionsTests.swift
in which we can test these two functions.
Interested
Is someone still working on this issue?
Hello, would like to know if this issue still opens? If yes I am interested to work on it, thanks.