Skip to content

Commit

Permalink
Merge pull request #209 from stratosphereips/improve-env
Browse files Browse the repository at this point in the history
netsecenv. Add check in actions to check if ips and nets is a real ip and nets
  • Loading branch information
eldraco authored Apr 25, 2024
2 parents 618ef5c + 9d42b13 commit d67b377
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions env/game_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ class IP():
"""
ip: str

def __post_init__(self):
"""
Check if the provided IP is valid
"""
try:
ipaddress.ip_address(self.ip)
except ValueError:
raise ValueError("Invalid IP address provided")

def __repr__(self):
return self.ip

Expand Down

0 comments on commit d67b377

Please sign in to comment.