feat(get_iface): add type information in response

This commit is contained in:
Mark Paronyan committed 2025-03-23 14:28:27 +00:00
1 parent ea2856289a
commit bab173ee52
2 files changed
+5 -1

No files matched your search

+3 -1
View File
@@ -324,17 +324,19 @@ async def get_iface(link: Link = Depends(dep_link)) -> dict[str, schemas.UdpPort
port_type = port.get("type", "")
if "udp" in port_type.lower():
ifaces_info[node.id] = {
"type": f"{port_type}",
"rhost": port["rhost"],
"lport": port["lport"],
"rport": port["rport"],
}
else:
ifaces_info[node.id] = {
"type": f"{port_type}",
"interface": port["interface"],
}
if not ifaces_info:
raise ControllerError(
"Link not connected to Cloud/NAT with UDP tunnel"
"Link not connected to Cloud/NAT"
)
return ifaces_info
+2
View File
@@ -102,6 +102,7 @@ class UdpPort(BaseModel):
lport: int
rhost: str
rport: int
type: str
class EthernetPort(BaseModel):
@@ -110,3 +111,4 @@ class EthernetPort(BaseModel):
"""
interface: str
type: str