GitHub IPv6代理

🇨🇳
🇨🇿
🇩🇪
🇬🇧
🇧🇷
🇷🇺
🇹🇷
🇺🇦
+

Recently I had to clone a git repository on GitHub via an IPv6 only server that I rented at my favourite hosting provider Hetzner. Unfortunately I realized that GitHub still does not support IPv6.

我开始建立起一个WireGuard VPN, 为此我使用了我的一个双核服务器另外一个可以让用于Tor匿名下载

当然我不是唯一一个有着IPv6问题的用户, 所以我决心将它作为一个公共代理服务器这样所有人都可以使用它进行GitHub仓库下载这个服务仅针对IPv6用户IPv4用户可以直接克隆GitHub仓库所以没有必要浪费服务器资源

注意,我的https代理正在为我的域名提供SSL验证服务。 这意味着我会解密并重新加密你的通信(我有能力直接监听你的通信,但我不会这么干). 你 有必要获得有关SSL验证的警告 Github会在接受警告之后重定向到默认端口以下是一个更能保护隐私的方法

所以它到底是怎么工作的?假设我们想要克隆一个 PHP聊天室脚本,就像我在 https://github.com/DanWin/le-chat-php 上发布的一样。一般情况下克隆仓库是这样的:
git clone https://github.com/DanWin/le-chat-php
在一个IPv6连接上,你可以这样使用我的代理服务:
git clone https://danwin1210.de:1443/DanWin/le-chat-php
如果你希望通过SSH的方式克隆仓库,你可以这么做:
git clone git@github-ipv6-proxy.danwin1210.de:DanWin/le-chat-php

那些希望永久使用我的服务的人 在我没有重新加密你的通信的情况下,应该添加这些内容到/etc/hosts :

2a01:4f8:c010:d56::2 github.com
2a01:4f8:c010:d56::3 api.github.com
2a01:4f8:c010:d56::4 codeload.github.com
2a01:4f8:c010:d56::6 ghcr.io
2a01:4f8:c010:d56::7 pkg.github.com npm.pkg.github.com maven.pkg.github.com nuget.pkg.github.com rubygems.pkg.github.com
2a01:4f8:c010:d56::8 uploads.github.com
2606:50c0:8000::133 objects.githubusercontent.com www.objects.githubusercontent.com release-assets.githubusercontent.com gist.githubusercontent.com repository-images.githubusercontent.com camo.githubusercontent.com private-user-images.githubusercontent.com avatars0.githubusercontent.com avatars1.githubusercontent.com avatars2.githubusercontent.com avatars3.githubusercontent.com cloud.githubusercontent.com desktop.githubusercontent.com support.github.com
2606:50c0:8000::154 support-assets.githubassets.com github.githubassets.com opengraph.githubassets.com github-registry-files.githubusercontent.com github-cloud.githubusercontent.com

Thanks to DeLegacy IPv6 RPZ some of above addresses are now served from official GitHub IPv6 addresses, which aren't published in their DNS zone yet.

当你添加完和谐配置之后,你就可以正常使用git clone命令,不需要做任何改变

git clone https://github.com/DanWin/le-chat-php

这个服务已经完成了,可正常使用。

http {
	server {
		listen [::]:1443 fastopen=100 backlog=2048 ipv6only=on ssl http2 default_server;
		location = /robots.txt {
			return 200 'User-agent: *
Disallow:';
		}
		location / {
			proxy_pass https://github.com;
			proxy_set_header Host "github.com";
		}
	}
}
stream {
	server {
		listen [2a01:4f8:c010:d56::2]:22 fastopen=100 ipv6only=on;
		proxy_pass github.com:22;
	}
	server {
		listen [2a01:4f8:c010:d56::2]:443 fastopen=100 ipv6only=on;
		proxy_pass github.com:443;
	}
	server {
		listen [2a01:4f8:c010:d56::3]:443 fastopen=100 ipv6only=on;
		proxy_pass api.github.com:443;
	}
	server {
		listen [2a01:4f8:c010:d56::4]:443 fastopen=100 ipv6only=on;
		proxy_pass codeload.github.com:443;
	}
	server {
		listen [2a01:4f8:c010:d56::6]:443 fastopen=100 ipv6only=on;
		proxy_pass ghcr.io:443;
	}
	server {
		listen [2a01:4f8:c010:d56::7]:443 fastopen=100 ipv6only=on;
		proxy_pass pkg.github.com:443;
	}
	server {
		listen [2a01:4f8:c010:d56::8]:443 fastopen=100 ipv6only=on;
		proxy_pass uploads.github.com:443;
	}
}

If there are any further questions, contact me.