added ipv4 and ipv6 detection