Use new network classes from tailscale_tun
This commit is contained in:
parent
1e5b9bcea1
commit
8a3da023d1
8 changed files with 1382 additions and 14 deletions
|
@ -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>
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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>
|
||||
|
|
1373
tun/ipstack.js
1373
tun/ipstack.js
File diff suppressed because one or more lines are too long
BIN
tun/ipstack.wasm
BIN
tun/ipstack.wasm
Binary file not shown.
Binary file not shown.
|
@ -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) => {
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue