File size: 568 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { isCanonicalDottedDecimalIPv4 } from "./ip.js";

export function validateDottedDecimalIPv4Input(value: string | undefined): string | undefined {
  if (!value) {
    return "IP address is required for custom bind mode";
  }
  if (isCanonicalDottedDecimalIPv4(value)) {
    return undefined;
  }
  return "Invalid IPv4 address (e.g., 192.168.1.100)";
}

// Backward-compatible alias for callers using the old helper name.
export function validateIPv4AddressInput(value: string | undefined): string | undefined {
  return validateDottedDecimalIPv4Input(value);
}