pikvm/pikvm#1339: Pass ICE servers to the Web UI

This commit is contained in:
Maxim Devaev
2025-02-24 19:51:43 +02:00
parent 72ef037959
commit 1cb5c11239
4 changed files with 26 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ class _Netcfg:
nat_type: StunNatType = dataclasses.field(default=StunNatType.ERROR)
src_ip: str = dataclasses.field(default="")
ext_ip: str = dataclasses.field(default="")
stun_host: str = dataclasses.field(default="")
stun_ip: str = dataclasses.field(default="")
stun_port: int = dataclasses.field(default=0)
@@ -172,7 +173,10 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes
part.format(**placeholders)
for part in cmd
]
self.__janus_proc = await aioproc.run_process(cmd)
self.__janus_proc = await aioproc.run_process(
cmd=cmd,
env={"JANUS_USTREAMER_WEB_ICE_URL": f"stun:{netcfg.stun_host}:{netcfg.stun_port}"},
)
get_logger(0).info("Started Janus pid=%d: %s", self.__janus_proc.pid, tools.cmdfmt(cmd))
async def __kill_janus_proc(self) -> None:

View File

@@ -30,6 +30,7 @@ class StunInfo:
nat_type: StunNatType
src_ip: str
ext_ip: str
stun_host: str
stun_ip: str
stun_port: int
@@ -102,6 +103,7 @@ class Stun:
nat_type=nat_type,
src_ip=src_ip,
ext_ip=ext_ip,
stun_host=self.__host,
stun_ip=self.__stun_ip,
stun_port=self.__port,
)