Skip to content

Instantly share code, notes, and snippets.

View M2shad0w's full-sized avatar
🎯
Focusing

Deyong Zhu M2shad0w

🎯
Focusing
View GitHub Profile
@M2shad0w
M2shad0w / go-get-ip-from-request
Created June 11, 2018 01:41 — forked from johnsonz/go-get-ip-from-request
go从Request获取IP地址
func GetIPFromRequest(r *http.Request) string {
ip, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
glog.Errorf("userip: %q is not IP:port", r.RemoteAddr)
return ""
}
userIP := net.ParseIP(ip)
if userIP == nil {
glog.Errorf("userip: %q is not IP:port", r.RemoteAddr)
return ""
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy