12个版本
0.1.18 | 2024年6月14日 |
---|---|
0.1.12 | 2024年1月8日 |
#36 in #separate
19KB
346 行
参考:谁不想要 2^64 个 IP 的代理池 ?https://zu1k.com/posts/tutorials/http-proxy-ipv6-pool/
- 编辑 /etc/sysctl.conf
添加 net.ipv6.ip_nonlocal_bind=1 然后 sudo sysctl -p
apt install -y networkd-dispatcher
ipv6=$(ip -6 addr show dev eth0 | grep "inet6.*scope global" | awk '{print $2}' | sed 's/::1\//::\//')
cat <<EOF > /usr/lib/networkd-dispatcher/routable.d/50-add-route
#!/bin/sh
if [ "\$IFACE" = "eth0" ]; then
ip route add local $ipv6 dev eth0
fi
EOF
chmod +x /usr/lib/networkd-dispatcher/routable.d/50-add-route
systemctl enable --now networkd-dispatcher || true
systemctl restart networkd-dispatcher
- 使用 curl 进行测试
❯ curl --interface 2a02:c206:2139:9706::2 ipv6.ip.sb 2a02:c206:2139:9706::2 ❯ curl --interface 2a02:c206:2139:9706::3 ipv6.ip.sb 2a02:c206:2139:9706::3 ❯ curl --interface 2a02:c206:2139:9706::abcd ipv6.ip.sb 2a02:c206:2139:9706::abcd
git clone --depth=1 [email protected]:i18n-api/http-proxy-ipv6-pool.git
cd http-proxy-ipv6-pool
./run.sh
测试
while true; do curl -x http://127.0.0.1:3198 ipv6.ip.sb; done
Http Proxy IPv6 Pool
使每个请求来自不同的IPv6地址。
https://zu1k.com/posts/tutorials/http-proxy-ipv6-pool/
教程
假设您已经将整个IPv6子网路由到您的服务器,对我来说,我购买了 Vultr的服务器 来获得一个。
获取您的IPv6子网前缀,对我来说是 2001:19f0:6001:48e4::/64
。
$ ip a
......
2: enp1s0: <BROADCAST,MULTICAST,ALLMULTI,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
......
inet6 2001:19f0:6001:48e4:5400:3ff:fefa:a71d/64 scope global dynamic mngtmpaddr
valid_lft 2591171sec preferred_lft 603971sec
......
通过默认互联网接口添加路由
ip route add local 2001:19f0:6001:48e4::/64 dev enp1s0
打开 ip_nonlocal_bind
以绑定任何IP地址
sysctl net.ipv6.ip_nonlocal_bind=1
对于IPv6 NDP,安装 ndppd
apt install ndppd
然后编辑 /etc/ndppd.conf
route-ttl 30000
proxy eth0 {
router no
timeout 500
ttl 30000
rule 2001:19f0:6001:48e4::/64 {
static
}
}
现在您可以使用 curl
进行测试
$ curl --interface 2001:19f0:6001:48e4::1 ipv6.ip.sb
2001:19f0:6001:48e4::1
$ curl --interface 2001:19f0:6001:48e4::2 ipv6.ip.sb
2001:19f0:6001:48e4::2
太棒了!
最后,使用本项目提供的http代理
$ while true; do curl -x http://127.0.0.1:3198 ipv6.ip.sb; done
2001:19f0:6001:48e4:971e:f12c:e2e7:d92a
2001:19f0:6001:48e4:6d1c:90fe:ee79:1123
2001:19f0:6001:48e4:f7b9:b506:99d7:1be9
2001:19f0:6001:48e4:a06a:393b:e82f:bffc
2001:19f0:6001:48e4:245f:8272:2dfb:72ce
2001:19f0:6001:48e4:df9e:422c:f804:94f7
2001:19f0:6001:48e4:dd48:6ba2:ff76:f1af
2001:19f0:6001:48e4:1306:4a84:570c:f829
2001:19f0:6001:48e4:6f3:4eb:c958:ddfa
2001:19f0:6001:48e4:aa26:3bf9:6598:9e82
2001:19f0:6001:48e4:be6b:6a62:f8f7:a14d
2001:19f0:6001:48e4:b598:409d:b946:17c
作者
依赖
~15–26MB
~388K SLoC