Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Use webrtc for coder sh #408

Merged
merged 3 commits into from
Aug 12, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into stevenmasley/ch1559…
…1/webrtc_sh
  • Loading branch information
Emyrk committed Aug 12, 2021
commit 8e15d364bdb16e4f2693cf5fd20ad8cbec47175d
29 changes: 18 additions & 11 deletions internal/cmd/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func configSSHCmd() *cobra.Command {
RunE: configSSH(&configpath, &remove, &additionalOptions),
}
cmd.Flags().StringVar(&configpath, "filepath", filepath.Join("~", ".ssh", "config"), "override the default path of your ssh config file")
cmd.Flags().StringSliceVarP(&additionalOptions, "option", "o", []string{}, "additional options injected in the ssh config (ex. disable caching with \"-o ControlPath=none\")")
cmd.Flags().BoolVar(&remove, "remove", false, "remove the auto-generated Coder ssh config")

return cmd
Expand Down Expand Up @@ -249,16 +248,24 @@ func makeNewConfigs(binPath string, workspaces []coderutil.WorkspaceWithWorkspac
return newConfig
}

func makeSSHConfig(binPath, workspaceName, privateKeyFilepath string) string {
entry := fmt.Sprintf(
`Host coder.%s
HostName coder.%s
ProxyCommand %s
StrictHostKeyChecking no
ConnectTimeout=0
IdentitiesOnly yes
IdentityFile="%s"
`, workspaceName, workspaceName, proxyCommand(binPath, workspaceName, true), privateKeyFilepath)
func makeSSHConfig(binPath, workspaceName, privateKeyFilepath string, additionalOptions []string) string {
// Custom user options come first to maximizessh customization.
options := []string{}
if len(additionalOptions) > 0 {
options = []string{
"# Custom options. Duplicated values will always prefer the first!",
}
options = append(options, additionalOptions...)
options = append(options, "# End custom options.")
}
options = append(options,
fmt.Sprintf("HostName coder.%s", workspaceName),
fmt.Sprintf("ProxyCommand %s", proxyCommand(binPath, workspaceName, true)),
"StrictHostKeyChecking no",
"ConnectTimeout=0",
"IdentitiesOnly yes",
fmt.Sprintf("IdentityFile=%q", privateKeyFilepath),
)

if runtime.GOOS == "linux" || runtime.GOOS == "darwin" {
options = append(options,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.