BuildProxyCommand constructs a ProxyCommand string for SOCKS5 proxies
(proxyType ProxyType, host, port string)
| 164 | |
| 165 | // BuildProxyCommand constructs a ProxyCommand string for SOCKS5 proxies |
| 166 | func 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 |
| 180 | func BuildProxyJump(user, host string) string { |