mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add network options, IPv6 for mqtt
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const ipAddressRegexp = /^(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]?)$/;
|
||||
const ipv6AddressRegexp = /^([a-fA-F0-9]{0,4}:([a-fA-F0-9]{0,4}:){1,6}[a-fA-F0-9]{0,4})$/;
|
||||
|
||||
export default function isIp(ipAddress: string) {
|
||||
return ipAddressRegexp.test(ipAddress);
|
||||
return ipAddressRegexp.test(ipAddress) || ipv6AddressRegexp.test(ipAddress);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user