MCPcopy Create free account
hub / github.com/Mister-leo/fssh / BuildProxyCommand

Function BuildProxyCommand

internal/sshconfig/hostconfig.go:166–177  ·  view source on GitHub ↗

BuildProxyCommand constructs a ProxyCommand string for SOCKS5 proxies

(proxyType ProxyType, host, port string)

Source from the content-addressed store, hash-verified

164
165// BuildProxyCommand constructs a ProxyCommand string for SOCKS5 proxies
166func BuildProxyCommand(proxyType ProxyType, host, port string) string {
167 switch proxyType {
168 case ProxyTypeSocks5NC:
169 return fmt.Sprintf("nc -X 5 -x %s:%s %%h %%p", host, port)
170 case ProxyTypeSocks5NCAT:
171 return fmt.Sprintf("ncat --proxy-type socks5 --proxy %s:%s %%h %%p", host, port)
172 case ProxyTypeHTTP:
173 return fmt.Sprintf("nc -X connect -x %s:%s %%h %%p", host, port)
174 default:
175 return ""
176 }
177}
178
179// BuildProxyJump constructs a ProxyJump string
180func BuildProxyJump(user, host string) string {

Callers 2

cmdAddFunction · 0.92
cmdEditFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected