Type-check ip addresses/domains

If you pass the incorret type, an assertion will fail in the native extension,
causing your node.js process to die (theres no way to catch this error!). Now
ip addresses are typechecked in js before being passed to native.