瀏覽代碼

Use new network classes from tailscale_tun

Yuri Iozzelli 2 年之前
父節點
當前提交
8a3da023d1
共有 8 個文件被更改,包括 10 次插入13 次删除
  1. 1 1
      index.html
  2. 3 4
      network.js
  3. 1 1
      tinycore.html
  4. 0 0
      tun/ipstack.js
  5. 二進制
      tun/ipstack.wasm
  6. 二進制
      tun/tailscale.wasm
  7. 2 3
      tun/tailscale_tun.js
  8. 3 4
      tun/tailscale_tun_auto.js

+ 1 - 1
index.html

@@ -34,7 +34,7 @@
     <script src="./xterm/xterm.js"></script>
     <script src="./xterm/xterm-addon-fit.js"></script>
     <script>
-        window.networkInterface = { bind: null, connect: null, listen: null, ready: false };
+        window.networkInterface = { ready: false };
     </script>
     <script type="module" src="network.js"></script>
   </head>

+ 3 - 4
network.js

@@ -51,16 +51,15 @@ const netmapUpdateCb = (map) => {
     const ip = map.self.addresses[0];
     statusElem.innerHTML = "IP: "+ip;
 };
-const { listen, connect, bind, up } = await autoConf({
+const { tcpSocket, udpSocket, up } = await autoConf({
     loginUrlCb,
     stateUpdateCb,
     netmapUpdateCb,
     authKey,
     controlUrl,
 });
-window.networkInterface.bind = bind;
-window.networkInterface.connect = connect;
-window.networkInterface.listen = listen;
+window.networkInterface.tcpSocket = tcpSocket;
+window.networkInterface.udpSocket = udpSocket;
 window.networkInterface.ready = true;
 loginElem.style.cursor = "pointer";
 statusElem.style.color = "white";

+ 1 - 1
tinycore.html

@@ -33,7 +33,7 @@
     <script src="./xterm/xterm.js"></script>
     <script src="./xterm/xterm-addon-fit.js"></script>
     <script>
-        window.networkInterface = { bind: null, connect: null, listen: null, ready: false };
+        window.networkInterface = { ready: false };
     </script>
     <script type="module" src="network.js"></script>
   </head>

File diff suppressed because it is too large
+ 0 - 0
tun/ipstack.js


二進制
tun/ipstack.wasm


二進制
tun/tailscale.wasm


+ 2 - 3
tun/tailscale_tun.js

@@ -83,9 +83,8 @@ export async function init() {
 
 
 	return {
-		connect: IpStack.connect,
-		listen: IpStack.listen,
-		bind: IpStack.bind,
+		tcpSocket: IpStack.TCPSocket.create,
+		udpSocket: IpStack.UDPSocket.create,
 		parseIP: IpStack.parseIP,
 		resolve: IpStack.resolve,
 		up: async (conf) => {

+ 3 - 4
tun/tailscale_tun_auto.js

@@ -1,7 +1,7 @@
 import {State, init} from "./tailscale_tun.js";
 
 export async function autoConf({loginUrlCb, stateUpdateCb, netmapUpdateCb, controlUrl, authKey}) {
-	const { listen, connect, bind, parseIP, resolve, up, down, login, logout, listeners } = await init();
+	const { tcpSocket, udpSocket, parseIP, resolve, up, down, login, logout, listeners } = await init();
 
 	const settings = {
 		controlUrl: controlUrl,
@@ -65,9 +65,8 @@ export async function autoConf({loginUrlCb, stateUpdateCb, netmapUpdateCb, contr
 	};
 
 	return {
-		bind,
-		connect,
-		listen,
+		tcpSocket,
+		udpSocket,
 		parseIP,
 		resolve,
 		up: async () => {

Some files were not shown because too many files changed in this diff