Use new network classes from tailscale_tun

This commit is contained in:
Yuri Iozzelli 2023-01-30 11:42:32 +01:00 committed by Alessandro Pignotti
parent 1e5b9bcea1
commit 8a3da023d1
8 changed files with 1382 additions and 14 deletions

View file

@ -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>

View file

@ -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";

View file

@ -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 one or more lines are too long

Binary file not shown.

Binary file not shown.

View file

@ -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) => {

View file

@ -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 () => {