MCPcopy
hub / github.com/smallstep/cli / proxycommandAction

Function proxycommandAction

command/ssh/proxycommand.go:70–96  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

68}
69
70func 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.

Callers

nothing calls this directly

Calls 4

doLoginIfNeededFunction · 0.85
getBastionFunction · 0.85
proxyBastionFunction · 0.85
proxyDirectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…