跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 使用sniproxy反代Github
未分類
30 12 月 2020

使用sniproxy反代Github

嗷嗷 大佬有话说 :

使用sniproxy反代Github

本帖最后由 嗷嗷 于 2020-12-30 12:53 编辑

用sniproxy做的

这是一个TCP4层转发工具

https://github.com/dlundquist/sniproxy

一、安装sniproxy

apt-get install -y git autotools-dev cdbs debhelper dh-autoreconf dpkg-dev gettext libev-dev libpcre3-dev libudns-dev pkg-config fakeroot devscripts
git clone https://github.com/dlundquist/sniproxy.git
cd sniproxy
./autogen.sh && dpkg-buildpackage
dpkg -i ../sniproxy_*_*.deb
apt-get install -y sniproxy

yum install -y git autoconf automake curl gettext-devel libev-devel pcre-devel perl pkgconfig rpm-build udns-devel
git clone https://github.com/dlundquist/sniproxy.git
cd sniproxy
./autogen.sh && ./configure && make dist
rpmbuild –define "_sourcedir `pwd`" -ba redhat/sniproxy.spec
yum install ../sniproxy-*.*.rpm
yum install -y sniproxy

二、修改sniproxy配置

找到开头就是table https_hosts {这一行

修改成下面这样子
# named tables are defined with the table directive
table https_hosts {
    # When proxying to local sockets you should use different tables since the
    # local socket server most likely will not autodetect which protocol is
    # being used
    example.org unix:/var/run/server.sock
    (.*.|)github.com$ *
    (.*.|)githubusercontent.com$ *
}

三、启动sniproxy

sniproxy -c /etc/sniproxy.conf

关闭:pkill sniproxy

四、在客户端设置hosts

修改/etc/hosts

如果原本有github的hosts配置了,就删除或者注释掉
添加下面的这些,把1.1.1.1改为你启动了sniproxy的VPS的IP

1.1.1.1 gist.github.com
1.1.1.1 github.com
1.1.1.1 www.github.com
1.1.1.1 api.github.com
1.1.1.1 avatars0.githubusercontent.com
1.1.1.1 avatars1.githubusercontent.com
1.1.1.1 avatars2.githubusercontent.com
1.1.1.1 avatars3.githubusercontent.com
1.1.1.1 avatars4.githubusercontent.com
1.1.1.1 avatars5.githubusercontent.com
1.1.1.1 avatars6.githubusercontent.com
1.1.1.1 avatars7.githubusercontent.com
1.1.1.1 avatars8.githubusercontent.com
1.1.1.1 camo.githubusercontent.com
1.1.1.1 cloud.githubusercontent.com
1.1.1.1 gist.githubusercontent.com
1.1.1.1 marketplace-screenshots.githubusercontent.com
1.1.1.1 raw.githubusercontent.com
1.1.1.1 repository-images.githubusercontent.com
1.1.1.1 user-images.githubusercontent.com

其他

IP add one:https://haoduck.com/713.html

如我上帖子所说:https://www.hostloc.com/thread-790321-1-1.html

我还是更想用nginx来反代,等什么时候闲了,我再试试看自签SSL证书来反代,看看行不行。

嗷嗷 大佬有话说 :

本帖最后由 嗷嗷 于 2020-12-30 01:24 编辑

2收藏0回复惨案

https://developer-forum-online.cdn.bcebos.com/a4e01f65-c456-4e57-a4d2-1227d21607b0.jpg

zxxx 大佬有话说 :

收藏备用。

CCCP 大佬有话说 :

https://keylol.com/static/image/smiley/steamcn_9/0461.gif 支持一下楼主https://cdn.jsdelivr.net/gh/hishis/forum-master/public/images/patch.gif

etc小号 大佬有话说 :

可以的楼主,解决了我同样的问题,华为的国内小鸡拉git的项目不是一般的慢

我用的方法是先导入到coding,再去拉,比这个麻烦不少

s920361 大佬有话说 :

nginx也有layer 4反代呀,透過sni來分流

dole 大佬有话说 :

好东西

嗷嗷 大佬有话说 :

s920361 大佬有话说 : 2020-12-30 01:56
nginx也有layer 4反代呀,透過sni來分流

这个我知道,但是要添加模块编译,我感觉有一点麻烦,之前用过,没有成功。这两天再研究一下

mryin 大佬有话说 :

问一下楼主,这个能反代一些不能访问的网站吗

Laa 大佬有话说 :

推荐nginx官方docker镜像 nginx:alpine 四层模块都做好了的 用着很方便

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具