mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Allow connection to ws console over IPv6. Fixes https://github.com/GNS3/gns3-web-ui/issues/1400
This commit is contained in:
parent
88a1cef21f
commit
658bfb7624
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
from gns3server.web.route import Route
|
from gns3server.web.route import Route
|
||||||
from gns3server.controller import Controller
|
from gns3server.controller import Controller
|
||||||
@ -477,7 +478,16 @@ class NodeHandler:
|
|||||||
await ws.prepare(request)
|
await ws.prepare(request)
|
||||||
request.app['websockets'].add(ws)
|
request.app['websockets'].add(ws)
|
||||||
|
|
||||||
ws_console_compute_url = "ws://{compute_host}:{compute_port}/v2/compute/projects/{project_id}/{node_type}/nodes/{node_id}/console/ws".format(compute_host=compute.host,
|
compute_host = compute.host
|
||||||
|
try:
|
||||||
|
# handle IPv6 address
|
||||||
|
ip = ipaddress.ip_address(compute_host)
|
||||||
|
if isinstance(ip, ipaddress.IPv6Address):
|
||||||
|
compute_host = '[' + compute_host + ']'
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
ws_console_compute_url = "ws://{compute_host}:{compute_port}/v2/compute/projects/{project_id}/{node_type}/nodes/{node_id}/console/ws".format(compute_host=compute_host,
|
||||||
compute_port=compute.port,
|
compute_port=compute.port,
|
||||||
project_id=project.id,
|
project_id=project.id,
|
||||||
node_type=node.node_type,
|
node_type=node.node_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user