Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion internal/cmd/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"os/user"
"path/filepath"
"runtime"
"sort"
"strings"

Expand Down Expand Up @@ -208,7 +209,7 @@ func makeNewConfigs(binPath, userName string, workspaces []coderutil.WorkspaceWi

func makeSSHConfig(binPath, host, userName, workspaceName, privateKeyFilepath string, tunnel bool) string {
if tunnel {
return fmt.Sprintf(
host := fmt.Sprintf(
`Host coder.%s
HostName coder.%s
ProxyCommand %s tunnel %s 12213 stdio
Expand All @@ -217,6 +218,15 @@ func makeSSHConfig(binPath, host, userName, workspaceName, privateKeyFilepath st
IdentitiesOnly yes
IdentityFile="%s"
`, workspaceName, workspaceName, binPath, workspaceName, privateKeyFilepath)

if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
host += ` ControlMaster auto
ControlPath ~/.ssh/.connection-%r@%h:%p
ControlPersist 600
`
}

return host
}

return fmt.Sprintf(
Expand Down
4 changes: 2 additions & 2 deletions wsnet/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,10 @@ func (l *listener) handle(msg BrokerMessage) func(dc *webrtc.DataChannel) {
rw: rw,
}
co.init()
defer co.Close()
defer nc.Close()

defer co.Close()
go func() {
defer dc.Close()
_, _ = io.Copy(co, nc)
}()
_, _ = io.Copy(nc, co)
Expand Down