import struct
import socket


def ip4_to_int(ip):
    """Convert IPv4 string to :py:class:`int`

    :param ip: IPv4 in dot-decimal notation
    :type ip: str
    :rtype: int
    """
    return struct.unpack(">L", socket.inet_aton(ip))[0]