• November 28, 2024

Go Get With Proxy

How do I configure go command to use a proxy? - Stack ...

How do I configure go command to use a proxy? – Stack …

I want to run go install to install the tour, but I can’t find the option to use a proxy for internet access. I don’t need this just for the tour but for developing in Go in general.
How do I configure Go to use a proxy.
xpt14. 6k20 gold badges82 silver badges159 bronze badges
asked Apr 30 ’12 at 11:55
Go programs understand environment variables _proxy and no_proxy, but that’s not enough because go get uses source control managers for retrieving code. So you have to set HTTP proxy settings for your SCM too. Use this for Mercurial and this for Git.
_proxy value can be like user:password@host:port/. User, password, and port parts are optional. no_proxy is a comma-separated list of servers that should not be connected through proxy. Its value can be like,
You can set these environment variables in your bash_profile, but if you want to limit their usage to go, you can run it like this:
$ _proxy=127. 0. 1:8080 go get
If that’s what you always want, set this alias to avoid typing proxy part every time:
$ alias go=’_proxy=127. 1:8080 go’
From now on you can use go normally, but it uses your HTTP proxy.
answered Apr 30 ’12 at 14:46
MostafaMostafa23. 7k9 gold badges53 silver badges51 bronze badges
6
On Windows command line:
set _proxy=[user]:[pass]@[proxy_ip]:[proxy_port]/
set _proxy=[user]:[pass]@[proxy_ip]:[proxy_port]/.. navigate to and download the GitHub certificate (I set the name as).. execute the OpenSSL command to export this to PEM format
openssl x509 -inform der -in -out
nally set the certificate in git global config
git config –global lCAInfo C:/Users/[User]/certs/
answered Nov 6 ’18 at 11:30
MarcoMarco2, 1972 gold badges21 silver badges15 bronze badges
you can also map requests to socks5 traffic by using
very handy if you are blocked by GFW
answered Jul 28 ’17 at 10:55
Lucas LiuLucas Liu6831 gold badge7 silver badges12 bronze badges
1
You may want check,
$ graftcp-local/graftcp-local -h
Usage of graftcp-local/graftcp-local:
-config string
Path to the configuration file
-listen string
Listen address (default “:2233”)
-logfile string
Write logs to file
-loglevel value
Log level (0-6) (default 1)
-pipepath string
Pipe path for graftcp to send address info (default “/tmp/”)
-service string
Control the system service: [“start” “stop” “restart” “install” “uninstall”]
-socks5 string
SOCKS5 address (default “127. 1:1080”)
-syslog
Send logs to the local system logger (Eventlog on Windows, syslog on Unix)
If you already have shadowsocks listening on 1080, then you don’t need provide any paramaters, just run graftcp-local, to proxy go get
$. /graftcp go get -v
answered Aug 25 ’18 at 4:53
fangxingfangxing4, 2262 gold badges36 silver badges44 bronze badges
This works for me:
alias go=’_proxy= _proxy= no_proxy=localhost, 127. 0/8, ::1 go’
Note: for someones, protocol may be different _proxy=
answered May 23 ’18 at 14:00
keoskeos8468 silver badges12 bronze badges
Add GOPROXY variable name and Variable value as your proxy in the System variable. This worked for me.
answered Jan 10 ’19 at 9:20
I solved this problem with the Go command setting some variables in the Win10 system.
Here (“Using the cf CLI with a Proxy Server”) you can find the information described below, with images. Also you can read information about:
Format of _proxy
Use SOCKS5 with cf v3-ssh
Set _proxy in Mac OS or Linux
I included in this answer only information about W10 because is the one I tested.
Set the new path variable.
From the search box, type in path
Select and open “Edit the system environment variables (control panel)”.
“System properties” window will open.
Select “Advanced” tab.
Press “Environment Variables” button, a window with the same name will open.
In “System Variables” section, press the “New” button. “New System Variable” window will open.
You’ll now add the needed variable, fill the fields as follows:
Variable name: _proxy
Variable value:yourUserName:userNamePassword@yourIPaddress:port
Lastly…
I tested the installation command line for go.
Open the console, and type in: go install
That’s an example from this project: This worked on my particular W10 19043 system.
answered Aug 10 at 12:27
carloswm85carloswm854635 silver badges10 bronze badges
git config [–global] git config [–global]
see
Note:
This answer has received both positive and negative feedback, if this method does not help on your case, please leave some comments before you click down-vote, cause this is actually documented and is working in my case. We’d better know why it does not work for you. Thanks.
answered Sep 5 ’18 at 14:41
Not the answer you’re looking for? Browse other questions tagged go or ask your own question.
How to use Golang's

How to use Golang’s “go get” from behind a proxy. – DEV …

In a perfect world employers would trust their employees, governments would care about the average person, and cats and dogs would get along together. Unfortunately the reality is that many organizations must use traffic proxies for both security and compliance with federal regulation. Luckily there is a way for Golang’s package manager “get” to work in such an environment. In this article we will look into how to clone a Golang based program from behind a corporate network proxy.
My Situation
This process is executed on a Windows 10 (build 1709) on a HP notebook. Inside of this is running Ubuntu 18. 04 via the Windows Subsystem for Linux (WSL) feature. All of this on a corporate network, connects to a client’s network via VPN. The network chain looks like this (even before the ‘internet’): local machine -> corporate network -> VPN tunnel connection -> client corporate network.
Process
Opening Ubuntu WSL I received the typical command prompt and entered the user password. Once log in completed I changed directories (cd) to the user’s home directory.
WSL is not 100% Linux, but it works, kinda, sorta.
The first thing I tried was the recommended command as documented in the README file.
go get
But that just got me an error, not surprising really.
Why does this always have to happen to me?
Interesting. GiT is not able to access the URL. So somewhere between my machine and the GitHub servers the communication routing fails. I wanted to trace the traffic to see where the requests started to fail. So I installed and ran traceroute to
sudo apt-get install -y aceroute * * *30 * * *
It would seem traceroute fails. Next I tried a curl request:
More dots more dots more dots; STOP ALL THE DOTS!
Ah! “302 not allowed”. And it looks like the Location cURL was redirected to is the page from the organizations proxy gateway.
This means we need to set the proxy setting for GiT. I knew that weeks back I have set the proxy value for Ubuntu’s APT program, so I tail’d APT”s config file for the value. To finish up I ran a git list command to ensure the value was saved.
$ tail /etc/apt/nfAcquire::::Proxy “YOUR_PROXY_URL_HERE:8888”;#source git config –global YOUR_PROXY_URL_HERE:8888$ git config –global
With the GiT proxy value now set I tried the following command…
After what seemed like hours (< 3 minutes) I received a different return message than before: nothing. I was back at the command prompt with no output. Could this mean return code 0? Doing a ls command of the ~/go/src directory. Hurrah! The project was indeed downloaded. Super Green! Conclusion With a little troubleshooting, knowledge share, and documentation reading I was able to get leverage the configuration ability of GiT to continue using "go get" to install applications. It would seem any program that downloads on a port other that 80 will need to be configured. May I should look into _proxt global usage. Do you have any knowledge about configuring programs to use proxy pass-throughs? Do you think corporate proxies are useless; or a necessity for the internet of today? Comment below and let me know. Set proxy when executing

Set proxy when executing “go get” command | Nan Xiao’s Blog

Skip to content
In Windows, if you have configured proxy for connecting Internet, then executing “go get” command may get error, like this:
C:\Users\xiaona>go get -v
Fetching fetch failed.
Fetching import “”: / fetch: Get l. v2? go-get=1: dial tcp 107. 178. 216. 236:80: ConnectEx tcp: A connection attempt
failed because the connected party did not properly respond after a period of ti
me, or established connection failed because connected host has failed to respon
d.
package unrecognized import path ”

The solution is set “_proxy” and/or “_proxy” environment variables according to your reality need:
C:\Users\xiaona>set _proxy=
Fetching Parsing meta tags from (status code 200)
get “”: found meta tag taImport{Prefix:”
tih/pool. v2″, VCS:”git”, RepoRoot:”} at g
(download)
All is OK now!

Frequently Asked Questions about go get with proxy

What is a go proxy?

A GOPROXY controls the source of your Go module downloads and can help assure builds are deterministic and secure. When developing in Golang before the GOPROXY era, module dependencies were downloaded directly from their source repositories in VCS systems such as GitHub, Bitbucket, Bazaar, Mercurial or SVN.May 7, 2020

Should I have proxy on or off?

It’s basically split into two configurations: either Automatic or Manual proxy setup. In 99% of the cases, everything should be set to Off. If anything is turned on, your web traffic could be going through a proxy.Oct 2, 2017

What does it mean to enable proxy?

iOS has a feature that allows you to set up a proxy so that all the network requests from your device are forwarded to a proxy server. This is usually used on business and school networks and can also be used for hiding your IP address or accessing websites that are blocked in your region.Feb 22, 2017

Leave a Reply