[~] Refactor
This commit is contained in:
		
							parent
							
								
									9620bb2b25
								
							
						
					
					
						commit
						83b1177f85
					
				| @ -1570,6 +1570,50 @@ def pass_ssh_osx(argv): | |||||||
|         clipboard_set('') |         clipboard_set('') | ||||||
|         print('\rcleared cliboard\n', end='') |         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): | def player_v1(folder_url, item_id): | ||||||
|     #import sys |     #import sys | ||||||
|     import urllib.parse |     import urllib.parse | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user