mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-04-26 13:59:56 +00:00
feat(get_iface): add type information in response
This commit is contained in:
parent
ea2856289a
commit
bab173ee52
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user