4

I build a socks5 proxy.

url="https://gitlab.com/muttmua/mutt/-/wikis/MailConcept"
curl --socks5-hostname 127.0.0.1:1080   $url

curl command can get the url via socks5 proxy.
To install tsocks:

sudo apt install tsocks

And set the configuration:

vim /etc/socks/tsocks.conf
server = 127.0.0.1
server_type = 5
server_port = 1080

Let curl run in tsocks:

tsocks curl $url

It can't get nothing!
It is no use to set variable with export:

export url="https://gitlab.com/muttmua/mutt/-/wikis/MailConcept"
tsocks curl $url
curl: (7) Failed to connect to gitlab.com port 443: Connection timed out
showkey
  • 482
  • 42
  • 140
  • 295

1 Answers1

-1

Curl becomes a subprocess of tsocks and with the way you declare the variable, it can not be accessed from a subprocess:

url="https://gitlab.com/muttmua/mutt/-/wikis/MailConcept"

change this to

export url="https://gitlab.com/muttmua/mutt/-/wikis/MailConcept"

See also: Defining a variable with or without export

Dharman
  • 30,962
  • 25
  • 85
  • 135
Coffeeholic
  • 367
  • 3
  • 16