cmd/tsconnect: add progress and connection callbacks

Allows UI to display slightly more fine-grained progress when the SSH
connection is being established.

Updates tailscale/corp#7186

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita
2022-10-17 15:02:59 -07:00
committed by Mihai Parparita
parent 246274b8e9
commit 7741e9feb0
4 changed files with 35 additions and 7 deletions
+6 -1
View File
@@ -46,7 +46,12 @@ function SSHSession({
const ref = useRef<HTMLDivElement>(null)
useEffect(() => {
if (ref.current) {
runSSHSession(ref.current, def, ipn, onDone, (err) => console.error(err))
runSSHSession(ref.current, def, ipn, {
onConnectionProgress: (p) => console.log("Connection progress", p),
onConnected() {},
onError: (err) => console.error(err),
onDone,
})
}
}, [ref])