IpConfig

Configure IP address validation with version and CIDR notation options.

The IpConfig interface extends the BaseValidatorConfig interface to provide configuration options for IP address validation. It allows you to specify the expected IP version (v4 or v6), whether to validate in CIDR notation, and customize error messages.

Inheritence

Properties:

  • version (Optional): An IpVersion enum value indicating the expected IP version.
    • IpVersion.V4: Validates for IPv4 addresses.
    • IpVersion.V6: Validates for IPv6 addresses.
    • IpVersion.AnyOne: Validates for any IP version (IPv4 or IPv6). Defaults to IpVersion.AnyOne if not specified.
  • isCidr (Optional): A boolean flag indicating whether to validate the IP address in CIDR notation (e.g., "192.168.1.0/24"). Defaults to false if not specified. Inherits all properties from BaseValidatorConfig (e.g., message, messageKey, and potentially conditionalExpression depending on the library implementation).