diff --git a/dotfiles/.local/bin/commands b/dotfiles/.local/bin/commands index 36301ef..d4c830c 100755 --- a/dotfiles/.local/bin/commands +++ b/dotfiles/.local/bin/commands @@ -1570,6 +1570,50 @@ def pass_ssh_osx(argv): clipboard_set('') print('\rcleared cliboard\n', end='') +def aioice_tunnel(argv: list[str]) -> None: + import aiortc + import logging + import asyncio + import json + import sys + + logging.basicConfig(level=logging.DEBUG) + + async def test(): + t1 = aiortc.RTCPeerConnection( + configuration=aiortc.RTCConfiguration( + iceServers=[ + aiortc.RTCIceServer( + urls=['stun:stun.l.google.com:19302'] + ) + ] + ) + ) + + t2 = t1.createDataChannel('test') + t3 = await t1.createOffer() + await t1.setLocalDescription(t3) + t4 = t1.localDescription + print(json.dumps(t4.sdp)) + t5 = json.loads(sys.stdin.readline()) + assert isinstance(t5, str) + await t1.setRemoteDescription( + aiortc.RTCSessionDescription( + sdp=t5, + type='answer' + ) + ) + + @t2.on('open') + async def send_message(): + t2.send('shit') + + return locals() + + t1 = await test() + + await asyncio.sleep(999) + def player_v1(folder_url, item_id): #import sys import urllib.parse