Skip to content

w-barros/portValidator

Repository files navigation

portValidator

Hello. This a simple validator for text input containing Network Ports made with Typescript. Main use is for validating user input for allowing/denying certain ports on a network security equipment interfacing system.
Current funcionality:

  • Checks if text inputted is a valid port or "any" string.
  • Checks if port is within valid range - 1-65535.
  • Accepts valid port ranges - within valid port range and start is lesser than end.
  • Accepts combinations of single ports and port ranges. Ie: "1010-2020 20 3030-4040 50"
  • Refuses repeated ports or port ranges. Ie: "8080 8080", "10-20 30 10-20".
  • Refuses common typos that may happen when dealing with such text.
  • It`s somewhat overly commented for better understanding.

Known issues: Accepts overlapping ranges, Ie: "15 10-20". Will look at this soon.

Includes some tests made with Jest:
image

Feel free to fork or reach out. Cheers!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors