Skip to main content

ip_address_validators

Depending on the given parameters, return the appropriate validators for the GenericIPAddressField.

def ip_address_validators(
protocol: string,
unpack_ipv4: boolean
) - > list

Depending on the given parameters, return the appropriate validators for the GenericIPAddressField.

Parameters

NameTypeDescription
protocolstringThe IP protocol version to validate against; must be 'ipv4', 'ipv6', or 'both'
unpack_ipv4booleanA flag indicating whether to decode IPv4-mapped IPv6 addresses; only permitted when protocol is set to 'both'

Returns

TypeDescription
listA list of validator functions corresponding to the specified IP protocol