Skip to content

Commit

Permalink
fixed jump hosts regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ferama committed Apr 24, 2021
1 parent 3a2084b commit eae8d85
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
16 changes: 9 additions & 7 deletions cmd/tun_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@ var tunForwardCmd = &cobra.Command{
SshClient: &conf.SshClientConf{
Identity: identity,
ServerURI: args[0],
JumpHosts: []*conf.JumpHostConf{
{
URI: jumpHost,
Identity: identity,
},
},
Insecure: insecure,
JumpHosts: make([]*conf.JumpHostConf, 0),
Insecure: insecure,
},
Tunnel: []*conf.TunnnelConf{
{
Expand All @@ -49,6 +44,13 @@ var tunForwardCmd = &cobra.Command{
},
}

if jumpHost != "" {
config.SshClient.JumpHosts = append(config.SshClient.JumpHosts, &conf.JumpHostConf{
URI: jumpHost,
Identity: identity,
})
}

client := sshc.NewSshConnection(config.SshClient)
go client.Start()
tun.NewTunnel(client, config.Tunnel[0]).Start()
Expand Down
17 changes: 10 additions & 7 deletions cmd/tun_reverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,8 @@ var tunReverseCmd = &cobra.Command{
SshClient: &conf.SshClientConf{
Identity: identity,
ServerURI: args[0],
JumpHosts: []*conf.JumpHostConf{
{
URI: jumpHost,
Identity: identity,
},
},
Insecure: insecure,
JumpHosts: make([]*conf.JumpHostConf, 0),
Insecure: insecure,
},
Tunnel: []*conf.TunnnelConf{
{
Expand All @@ -59,6 +54,14 @@ var tunReverseCmd = &cobra.Command{
},
},
}

if jumpHost != "" {
config.SshClient.JumpHosts = append(config.SshClient.JumpHosts, &conf.JumpHostConf{
URI: jumpHost,
Identity: identity,
})
}

if startSshD {
sshdKey, _ := cmd.Flags().GetString("sshd-key")
sshdAuthorizedKeys, _ := cmd.Flags().GetString("sshd-authorized-keys")
Expand Down

0 comments on commit eae8d85

Please sign in to comment.