Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Maxconn and added nscache6 #9

Open
wants to merge 20 commits into
base: fix/mem-limit
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ Redirect connections from different ports at one ipv4 address to unique random i

## Requirements
- Centos 7
- Ipv6 \64
- IPv6 \64

## Installation
[Video tutorial](https://youtu.be/EKBJHSTmT4w), VPS from [Vultr *50$ free*](https://www.vultr.com/?ref=7847672-4F) used as Centos setup
[Video tutorial](https://youtu.be/EKBJHSTmT4w), VPS from [Vultr ($100 Free Credit)](https://www.vultr.com/?ref=8519302-6G) used as Centos setup

1. `bash <(curl -s "https://raw.githubusercontent.com/dukaev/ipv6_proxy/master/scripts/install.sh")`
1. For regular user/pass auth proxies, use: `bash <(curl -s "https://raw.githubusercontent.com/ItsDaWither/ipv4-ipv6-proxy/master/scripts/install.sh")`
2. For IP-Auth proxies, use: `bash <(curl -s "https://raw.githubusercontent.com/ItsDaWither/ipv4-ipv6-proxy/master/scripts/install-ipauth.sh")`

1. After installation dowload the file `proxy.zip`
* File structure: `IP4:PORT:LOGIN:PASS`
* You can use this online [util](http://buyproxies.org/panel/format.php
) to change proxy format as you like

## Test your proxy

Install [FoxyProxy](https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-standard/) in Firefox
![Foxy](foxyproxy.png)

Open [ipv6-test.com](http://ipv6-test.com/) and check your connection
![check ip](check_ip.png)
* File structure: `IP4:PORT:LOGIN:PASS` or `IP4:PORT`
68 changes: 0 additions & 68 deletions scripts/3proxy.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/build.sh

This file was deleted.

117 changes: 117 additions & 0 deletions scripts/install-ipauth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/sh
random() {
tr </dev/urandom -dc A-Za-z0-9 | head -c5
echo
}

array=(1 2 3 4 5 6 7 8 9 0 a b c d e f)
gen64() {
ip64() {
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}"
}
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)"
}
install_3proxy() {
echo "installing 3proxy"
URL="https://github.com/z3APA3A/3proxy/archive/3proxy-0.8.6.tar.gz"
wget -qO- $URL | bsdtar -xvf-
cd 3proxy-3proxy-0.8.6
make -f Makefile.Linux
mkdir -p /usr/local/etc/3proxy/{bin,logs,stat}
cp src/3proxy /usr/local/etc/3proxy/bin/
cp ./scripts/rc.d/proxy.sh /etc/init.d/3proxy
chmod +x /etc/init.d/3proxy
chkconfig 3proxy on
cd $WORKDIR
}

gen_3proxy() {
cat <<EOF
daemon
maxconn 1000
nscache 65536
nscache6 65536
timeouts 1 5 30 60 180 1800 15 60
setgid 65535
setuid 65535
stacksize 262144
flush
auth iponly

$(awk -F "/" '{print "auth iponly\n" \
"allow * " $1 "\n" \
"proxy -6 -n -a -p" $3 " -i" $2 " -e"$4"\n" \
"flush\n"}' ${WORKDATA})
EOF
}

gen_proxy_file_for_user() {
cat >proxy.txt <<EOF
$(awk -F "/" '{print $2 ":" $3 }' ${WORKDATA})
EOF
}

upload_proxy() {
local PASS=$(random)
zip --password $PASS proxy.zip proxy.txt
URL=$(curl -s --upload-file proxy.zip https://transfer.sh/proxy.zip)

echo "Proxy is ready! Format IP:PORT"
echo "Download zip archive from: ${URL}"
echo "Password: ${PASS}"

}
gen_data() {
seq $FIRST_PORT $LAST_PORT | while read port; do
echo "$IP_AUTHORIZATION/$IP4/$port/$(gen64 $IP6)"
done
}

gen_ifconfig() {
cat <<EOF
$(awk -F "/" '{print "ifconfig eth0 inet6 add " $4 "/64"}' ${WORKDATA})
EOF
}
echo "installing apps"
yum -y install gcc net-tools bsdtar zip >/dev/null

install_3proxy

echo "working folder = /home/proxy-installer"
WORKDIR="/home/proxy-installer"
WORKDATA="${WORKDIR}/data.txt"
mkdir $WORKDIR && cd $_

IP4=$(curl -4 -s icanhazip.com)
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':')

echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}"

echo "How many proxy do you want to create? Example 500"
read COUNT

FIRST_PORT=10000
LAST_PORT=$(($FIRST_PORT + $COUNT))

echo "Which IP do you want to authorize the proxies for?"
read IP_AUTHORIZATION

gen_data >$WORKDIR/data.txt
iptables -I INPUT -p tcp --dport $IP6::/64 -m state --state NEW -j ACCEPT
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
chmod +x boot_*.sh /etc/rc.local

gen_3proxy >/usr/local/etc/3proxy/3proxy.cfg

cat >>/etc/rc.local <<EOF
bash ${WORKDIR}/boot_iptables.sh
bash ${WORKDIR}/boot_ifconfig.sh
ulimit -n 65536
service 3proxy start
EOF

bash /etc/rc.local

gen_proxy_file_for_user

upload_proxy
9 changes: 5 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ install_3proxy() {
gen_3proxy() {
cat <<EOF
daemon
maxconn 1000
maxconn 500
nscache 65536
nscache6 65536
timeouts 1 5 30 60 180 1800 15 60
setgid 65535
setuid 65535
Expand Down Expand Up @@ -89,8 +90,8 @@ WORKDIR="/home/proxy-installer"
WORKDATA="${WORKDIR}/data.txt"
mkdir $WORKDIR && cd $_

IP4=$(curl -4 -s ifconfig.co)
IP6=$(curl -6 -s ifconfig.co | cut -f1-4 -d':')
IP4=$(curl -4 -s icanhazip.com)
IP6=$(curl -6 -s icanhazip.com | cut -f1-4 -d':')

echo "Internal ip = ${IP4}. Exteranl sub for ip6 = ${IP6}"

Expand All @@ -101,7 +102,7 @@ FIRST_PORT=10000
LAST_PORT=$(($FIRST_PORT + $COUNT))

gen_data >$WORKDIR/data.txt
gen_iptables >$WORKDIR/boot_iptables.sh
iptables -I INPUT -p tcp --dport $IP6::/64 -m state --state NEW -j ACCEPT
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
chmod +x boot_*.sh /etc/rc.local

Expand Down
40 changes: 0 additions & 40 deletions scripts/main.sh

This file was deleted.

69 changes: 69 additions & 0 deletions scripts/proxy-rotation-ipauth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/sh
random() {
tr </dev/urandom -dc A-Za-z0-9 | head -c5
echo
}

array=(1 2 3 4 5 6 7 8 9 0 a b c d e f)
gen64() {
ip64() {
echo "${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}${array[$RANDOM % 16]}"
}
echo "$1:$(ip64):$(ip64):$(ip64):$(ip64)"
}

gen_data() {
seq $FIRST_PORT $LAST_PORT | while read port; do
echo "$IP_AUTHORIZATION/$IP4/$port/$(gen64 $IP6)"
done
}

gen_3proxy() {
cat <<EOF
daemon
maxconn 1000
nscache 65536
nscache6 65536
timeouts 1 5 30 60 180 1800 15 60
setgid 65535
setuid 65535
stacksize 262144
flush
auth iponly

$(awk -F "/" '{print "auth iponly\n" \
"allow * " $1 "\n" \
"proxy -6 -n -a -p" $3 " -i" $2 " -e"$4"\n" \
"flush\n"}' ${WORKDATA})
EOF
}

gen_ifconfig() {
cat <<EOF
$(awk -F "/" '{print "ifconfig eth0 inet6 add " $4 "/64"}' ${WORKDATA})
EOF
}

echo "working folder = /home/proxy-installer"
WORKDIR="/home/proxy-installer"
WORKDATA="${WORKDIR}/data.txt"
cd $WORKDIR

IP4=$(curl -4 -s ifconfig.co)
IP6=$(curl -6 -s ifconfig.co | cut -f1-4 -d':')
COUNT=500

FIRST_PORT=10000
LAST_PORT=$(($FIRST_PORT + $COUNT))
IP_AUTHORIZATION=

gen_data >$WORKDIR/data.txt
iptables -I INPUT -p tcp --dport $IP6::/64 -m state --state NEW -j ACCEPT
gen_ifconfig >$WORKDIR/boot_ifconfig.sh
gen_3proxy >/usr/local/etc/3proxy/3proxy.cfg

bash $WORKDIR/boot_iptables.sh
bash $WORKDIR/boot_ifconfig.sh

systemctl stop 3proxy
systemctl start 3proxy
Loading