Syslog host setting as ipv4 or hostname

This commit is contained in:
MichaelDvP
2021-07-26 11:41:23 +02:00
parent 1df427366f
commit 1cf938e16a
6 changed files with 47 additions and 49 deletions

View File

@@ -3,3 +3,4 @@ export { default as isIP } from './isIP';
export { default as optional } from './optional';
export { default as or } from './or';
export { default as isPath } from './isPath';
export { default as isIPv4 } from './isIPv4';

View File

@@ -0,0 +1,5 @@
const ipv4AddressRegexp = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
export default function isIpv4(ipAddress: string) {
return ipv4AddressRegexp.test(ipAddress);
}