Skip to content

Commit

Permalink
readded ip support
Browse files Browse the repository at this point in the history
  • Loading branch information
DenFlyvendeGed committed Dec 14, 2023
1 parent 85e0647 commit 4692d6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/classes/engine/Validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ export function validateName(name: string | undefined): boolean {
return false;
}

const regexTest: RegExp = new RegExp(
"^(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]?)$", // Will test for any valid IP address
);

export function validateIP(ipAdress: string): boolean {
return URL.canParse(ipAdress);
return URL.canParse(ipAdress) || regexTest.test(ipAdress);
}

export function validateStartPort(port: number): boolean {
Expand Down

0 comments on commit 4692d6d

Please sign in to comment.