Skip to main content

ipv6

$ipv6

Validates that a string is a properly formatted IPv6 address. Supports all standard notation formats including full, compressed (::), link-local with zone identifiers, and IPv4-mapped addresses.

Parameters

  • in (string, optional): Network range to validate against. Accepts CIDR notation (e.g. 'fe80::/10') or a named range: loopback, link-local, unique-local, multicast, non-routable.
  • min (string, optional): Minimum IPv6 address (inclusive).
  • max (string, optional): Maximum IPv6 address (inclusive).

Use either in OR min/max, not both.

Example

// Format-only validation
new Schema('string').validator('$ipv6')

// CIDR range (positional `in`)
new Schema('string').validator({$ipv6: '2001:db8::/32'})

// Named range
new Schema('string').validator({$ipv6: 'unique-local'})

// Explicit min/max
new Schema('string').validator({$ipv6: {min: '2001:db8::1', max: '2001:db8::ffff'}})