misc: addressed comments

This commit is contained in:
Sheen Capadngan
2025-02-20 01:46:50 +08:00
parent f0e6bcef9b
commit d6c1b8e30c
13 changed files with 41 additions and 32 deletions
+6
View File
@@ -107,6 +107,12 @@ export const isValidIp = (ip: string) => {
return net.isIPv4(ip) || net.isIPv6(ip);
};
export const isValidHostname = (name: string) => {
const hostnameRegex = /^(?!:\/\/)(\*\.)?([a-zA-Z0-9-_]{1,63}\.?)+(?!:\/\/)([a-zA-Z]{2,63})$/;
return hostnameRegex.test(name);
};
export type TIp = {
ipAddress: string;
type: IPType;