Add --socks5 flag to support socks5 proxy

This commit is contained in:
Dave Gallant
2024-07-20 20:06:07 -04:00
parent 679a63cc14
commit a45602ce5d
6 changed files with 38 additions and 20 deletions

View File

@@ -16,24 +16,26 @@ import (
)
var (
flagRandom bool
flagReconnect bool
flagRandom bool
flagReconnect bool
flagSocks5Proxy string
)
func init() {
connectCmd.Flags().BoolVarP(&flagRandom, "random", "r", false, "connect to a random server")
connectCmd.Flags().BoolVarP(&flagReconnect, "reconnect", "t", false, "continually attempt to connect to the server")
connectCmd.Flags().StringVarP(&flagSocks5Proxy, "socks5", "s", "", "provide a socks5 proxy server to connect through (i.e. 127.0.0.1:1080")
rootCmd.AddCommand(connectCmd)
}
var connectCmd = &cobra.Command{
Use: "connect",
Use: "connect",
Short: "Connect to a vpn server (survey selection appears if hostname is not provided)",
Long: `Connect to a vpn from a list of relay servers`,
Args: cobra.RangeArgs(0, 1),
Run: func(cmd *cobra.Command, args []string) {
vpnServers, err := vpn.GetList()
vpnServers, err := vpn.GetList(flagSocks5Proxy)
if err != nil {
log.Fatal().Msgf(err.Error())
os.Exit(1)