Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save asd2003asd/5ef87ef63e509b37f4e90b67a0716b9f to your computer and use it in GitHub Desktop.
Save asd2003asd/5ef87ef63e509b37f4e90b67a0716b9f to your computer and use it in GitHub Desktop.

Revisions

  1. @alexniver alexniver revised this gist Aug 31, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -84,7 +84,7 @@ sudo service privoxy restart
    export http_proxy=http://127.0.0.1:8118
    export https_proxy=http://127.0.0.1:8118
    ```
    当然也可以只对当前命令行设置http_proxy, 在当前窗口执行上面的代码即可
    当然也可以只对当前命令行设置http_proxy, 在当前窗口执行上面的代码即可(使用全局配置, 可以在安装 vim插件时也生效,如GoInstallBinaries)


    重启机器
  2. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -84,6 +84,8 @@ sudo service privoxy restart
    export http_proxy=http://127.0.0.1:8118
    export https_proxy=http://127.0.0.1:8118
    ```
    当然也可以只对当前命令行设置http_proxy, 在当前窗口执行上面的代码即可


    重启机器
    ```
  3. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -85,7 +85,10 @@ export http_proxy=http://127.0.0.1:8118
    export https_proxy=http://127.0.0.1:8118
    ```

    重启机器
    重启机器
    ```
    sudo shutdown -r now
    ```

    尝试一次不纯洁的go get
    ```
  4. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,17 @@ sudo apt-get update
    sudo apt-get install privoxy
    ```

    配置Privoxy, 打开 /etc/privoxy/config, 在最后一行后边加上
    配置Privoxy, 打开 /etc/privoxy/config,

    注释掉
    ```
    listen-address localhost:8118
    ```
    ```
    #listen-address localhost:8118
    ```

    在最后一行后边加上
    ```
    forward-socks5 / 127.0.0.1:1080 .
    listen-address 127.0.0.1:8118
  5. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,6 @@ nohup bash /home/tom/shadow-sock/startSslocal.sh>/home/tom/shadow-sock/startSslo
    安装Privoxy
    ```
    sudo apt-get update
    sudo apt-get install privoxy
    ```

  6. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -68,14 +68,17 @@ listen-address 127.0.0.1:8118
    ```
    sudo service privoxy restart
    ```
    这样就完成了sock5到http代理的映射

    然后就可以配置全局proxy, sudo vi /etc/environment, 加入下面的代码
    然后就可以配置全局http proxy, sudo vi /etc/environment, 加入下面的代码
    ```
    export http_proxy=http://127.0.0.1:8118
    export https_proxy=http://127.0.0.1:8118
    ```

    重启机器

    尝试一次不纯洁的go get
    ```
    go get golang.org/x/net/publicsuffix
    ```
  7. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@

    #解决方案
    shadowsock + Privoxy

    思路就是, 使用shadowsock建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.


  8. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -82,6 +82,8 @@ go get golang.org/x/net/publicsuffix


    #参考链接:
    *(http://1.guotie.sinaapp.com/?p=802)
    *(http://www.chenxuanyi.cn/privoxy-socks-http.html)
    *(http://www.mokeedev.com/2014/07/23/syncandroidsource/)
    http://1.guotie.sinaapp.com/?p=802

    http://www.chenxuanyi.cn/privoxy-socks-http.html

    http://www.mokeedev.com/2014/07/23/syncandroidsource/
  9. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -82,6 +82,6 @@ go get golang.org/x/net/publicsuffix


    #参考链接:
    http://1.guotie.sinaapp.com/?p=802
    http://www.chenxuanyi.cn/privoxy-socks-http.html
    http://www.mokeedev.com/2014/07/23/syncandroidsource/
    *(http://1.guotie.sinaapp.com/?p=802)
    *(http://www.chenxuanyi.cn/privoxy-socks-http.html)
    *(http://www.mokeedev.com/2014/07/23/syncandroidsource/)
  10. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ nohup bash /home/tom/shadow-sock/startSslocal.sh>/home/tom/shadow-sock/startSslo
    ```
    则证明ubuntu目前已经启动好了sock5的代理, 代理为: 127.0.0.1:1080.

    此时如果配合SwitchyOmega, 配置一下sock5的代理, 则可以完成类似之前goagent的自动翻墙.
    此时如果配合SwitchyOmega, 配置一下sock5的代理, 则可以完成类似之前goagent的自动科学上网(PS:在此沉痛悼念下goagent同志).



  11. @alexniver alexniver revised this gist Nov 8, 2015. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions golang, ubuntu go get in china.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,17 @@
    #前言
    由于大家都懂的, 国内使用go get的时候, 经常会各种失败, 如果有vpn的话, 打开vpn, 问题就解决了, 但vpn其实挺不灵活的, 相对来说shadowsock则灵活得多.
    由于大家都懂的, 国内使用go get的时候, 经常会各种失败, 如果有vpn的话, 打开vpn, 问题就解决了, 但vpn其实挺不灵活的.

    相对来说shadowsock则灵活得多.

    #解决方案
    shadowsock + Privoxy
    思路就是, 使用shadowsock建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.


    ## shadowsock
    首先你要有一个自己的shadowsock服务器, 确保好用.我目前用的是https://bandwagonhost.com/clientarea.php, 貌似24人民币买了一年的. 详情配置自己查, 很简单.
    首先你要有一个自己的shadowsock服务器, 确保好用.

    我目前用的是https://bandwagonhost.com/clientarea.php, 貌似24人民币买了一年的. 详情配置自己查, 很简单.

    然后:
    ```
    @@ -20,7 +24,9 @@ sudo pip install shadowsocks
    sudo ln -s /usr/local/bin/sslocal /bin/sslocal
    ```

    之后找个目录新建个文件startSslocal.sh, 将下面的内容写到里面, 将ip, port, password替换为自己的shadowsock的配置.(其余配置不需要管,使用默认即可)
    之后找个目录新建个文件startSslocal.sh,

    将下面的内容写到里面, 将ip, port, password替换为自己的shadowsock的配置.(其余配置不需要管,使用默认即可)
    ```
    #!/bin/bash
    sslocal -s ip -p port -k "password"
    @@ -36,7 +42,9 @@ nohup bash /home/tom/shadow-sock/startSslocal.sh>/home/tom/shadow-sock/startSslo
    2015-11-08 22:36:34 INFO loading libcrypto from libcrypto.so.1.0.0
    2015-11-08 22:36:34 INFO starting local at 127.0.0.1:1080
    ```
    则证明ubuntu目前已经启动好了sock5的代理, 代理为: 127.0.0.1:1080. 此时如果配合SwitchyOmega, 配置一下sock5的代理, 则可以完成类似之前goagent的自动翻墙.
    则证明ubuntu目前已经启动好了sock5的代理, 代理为: 127.0.0.1:1080.

    此时如果配合SwitchyOmega, 配置一下sock5的代理, 则可以完成类似之前goagent的自动翻墙.



  12. @alexniver alexniver renamed this gist Nov 8, 2015. 1 changed file with 0 additions and 0 deletions.
  13. @alexniver alexniver revised this gist Nov 8, 2015. No changes.
  14. @alexniver alexniver created this gist Nov 8, 2015.
    79 changes: 79 additions & 0 deletions golang, ubuntu go get in china
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,79 @@
    #前言
    由于大家都懂的, 国内使用go get的时候, 经常会各种失败, 如果有vpn的话, 打开vpn, 问题就解决了, 但vpn其实挺不灵活的, 相对来说shadowsock则灵活得多.

    #解决方案
    shadowsock + Privoxy
    思路就是, 使用shadowsock建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.


    ## shadowsock
    首先你要有一个自己的shadowsock服务器, 确保好用.我目前用的是https://bandwagonhost.com/clientarea.php, 貌似24人民币买了一年的. 详情配置自己查, 很简单.

    然后:
    ```
    sudo apt-get install python-pip
    sudo pip install shadowsocks
    ```

    找到:sslocal(sudo find / -name sslocal) 这个命令所在的目录, 将sslocal软链接到/bin中.
    ```
    sudo ln -s /usr/local/bin/sslocal /bin/sslocal
    ```

    之后找个目录新建个文件startSslocal.sh, 将下面的内容写到里面, 将ip, port, password替换为自己的shadowsock的配置.(其余配置不需要管,使用默认即可)
    ```
    #!/bin/bash
    sslocal -s ip -p port -k "password"
    ```

    然后就是设置startSslocal.sh开机自动启动, 编辑/etc/rc.local, 将下面内容(按情况修改为你自己的)写到rc.local中
    ```
    nohup bash /home/tom/shadow-sock/startSslocal.sh>/home/tom/shadow-sock/startSslocal.log &
    ```

    重新启动, 如果startSslocal.log中的日志为:
    ```
    2015-11-08 22:36:34 INFO loading libcrypto from libcrypto.so.1.0.0
    2015-11-08 22:36:34 INFO starting local at 127.0.0.1:1080
    ```
    则证明ubuntu目前已经启动好了sock5的代理, 代理为: 127.0.0.1:1080. 此时如果配合SwitchyOmega, 配置一下sock5的代理, 则可以完成类似之前goagent的自动翻墙.



    #使用Privoxy将sock5代理映射为http代理.

    安装Privoxy
    ```
    sudo apt-get update

    sudo apt-get install privoxy
    ```

    配置Privoxy, 打开 /etc/privoxy/config, 在最后一行后边加上
    ```
    forward-socks5 / 127.0.0.1:1080 .
    listen-address 127.0.0.1:8118
    ```

    然后重启Privoxy
    ```
    sudo service privoxy restart
    ```

    然后就可以配置全局proxy, sudo vi /etc/environment, 加入下面的代码
    ```
    export http_proxy=http://127.0.0.1:8118
    export https_proxy=http://127.0.0.1:8118
    ```

    重启机器
    ```
    go get golang.org/x/net/publicsuffix
    ```
    应该可以无错误运行.有错误我也没办法了~~~~ 生活在天朝当个码农真心不容易


    #参考链接:
    http://1.guotie.sinaapp.com/?p=802
    http://www.chenxuanyi.cn/privoxy-socks-http.html
    http://www.mokeedev.com/2014/07/23/syncandroidsource/