Skip to content

Commit

Permalink
Service.get_port()
Browse files Browse the repository at this point in the history
  • Loading branch information
raulikak committed Apr 26, 2024
1 parent c4d3337 commit 735a793
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tcsfw/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ def is_encrypted(self) -> bool:
"""Is an encrypted service?"""
return self.protocol in {Protocol.TLS, Protocol.SSH}

def get_port(self) -> int:
"""Resolve port number, return -1 if not found"""
for a in self.addresses:
app = a.get_protocol_port()
if app:
return app[1]
return -1

def __repr__(self):
return f"{self.status_string()} {self.parent.long_name()} {self.name}"

Expand Down

0 comments on commit 735a793

Please sign in to comment.