MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / findSshDefaults

Function findSshDefaults

pkg/remote/sshclient.go:1111–1134  ·  view source on GitHub ↗
(hostPattern string)

Source from the content-addressed store, hash-verified

1109}
1110
1111func findSshDefaults(hostPattern string) (connKeywords *wconfig.ConnKeywords, outErr error) {
1112 sshKeywords := &wconfig.ConnKeywords{}
1113
1114 userDetails, err := user.Current()
1115 if err != nil {
1116 return nil, err
1117 }
1118 sshKeywords.SshUser = &userDetails.Username
1119 sshKeywords.SshHostName = &hostPattern
1120 sshKeywords.SshPort = utilfn.Ptr(ssh_config.Default("Port"))
1121 sshKeywords.SshIdentityFile = ssh_config.DefaultAll("IdentityFile", hostPattern, ssh_config.DefaultUserSettings) // use the sshconfig here. should be different later
1122 sshKeywords.SshBatchMode = utilfn.Ptr(false)
1123 sshKeywords.SshPubkeyAuthentication = utilfn.Ptr(true)
1124 sshKeywords.SshPasswordAuthentication = utilfn.Ptr(true)
1125 sshKeywords.SshKbdInteractiveAuthentication = utilfn.Ptr(true)
1126 sshKeywords.SshPreferredAuthentications = strings.Split(ssh_config.Default("PreferredAuthentications"), ",")
1127 sshKeywords.SshAddKeysToAgent = utilfn.Ptr(false)
1128 sshKeywords.SshIdentitiesOnly = utilfn.Ptr(false)
1129 sshKeywords.SshIdentityAgent = utilfn.Ptr(ssh_config.Default("IdentityAgent"))
1130 sshKeywords.SshProxyJump = []string{}
1131 sshKeywords.SshUserKnownHostsFile = strings.Fields(ssh_config.Default("UserKnownHostsFile"))
1132 sshKeywords.SshGlobalKnownHostsFile = strings.Fields(ssh_config.Default("GlobalKnownHostsFile"))
1133 return sshKeywords, nil
1134}
1135
1136type SSHOpts struct {
1137 SSHHost string `json:"sshhost"`

Callers 1

ConnectToClientFunction · 0.85

Calls 1

PtrFunction · 0.92

Tested by

no test coverage detected