(ctx *cli.Context)
| 68 | } |
| 69 | |
| 70 | func proxycommandAction(ctx *cli.Context) error { |
| 71 | if err := errs.NumberOfArguments(ctx, 3); err != nil { |
| 72 | return err |
| 73 | } |
| 74 | |
| 75 | args := ctx.Args() |
| 76 | user, host, port := args[0], args[1], args[2] |
| 77 | |
| 78 | // Check if user is logged in |
| 79 | if err := doLoginIfNeeded(ctx, user); err != nil { |
| 80 | return err |
| 81 | } |
| 82 | |
| 83 | // Get the configured bastion if any |
| 84 | r, err := getBastion(ctx, user, host) |
| 85 | if err != nil { |
| 86 | return err |
| 87 | } |
| 88 | |
| 89 | // Connect through bastion |
| 90 | if r.Bastion != nil && r.Bastion.Hostname != "" { |
| 91 | return proxyBastion(r, user, host, port) |
| 92 | } |
| 93 | |
| 94 | // Connect directly |
| 95 | return proxyDirect(host, port) |
| 96 | } |
| 97 | |
| 98 | // doLoginIfNeeded check if the user is logged in looking at the ssh agent, if |
| 99 | // it's not it will do the login flow. |
nothing calls this directly
no test coverage detected
searching dependent graphs…