Skip to content

Commit 1767ec7

Browse files
authored
Update install.sh
1 parent 671e8ee commit 1767ec7

File tree

1 file changed

+203
-21
lines changed

1 file changed

+203
-21
lines changed

install.sh

Lines changed: 203 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ install_obfs4() {
3838
fi
3939
fi
4040
}
41+
4142
configure_obfs4() {
4243
local obfs4_dir="/etc/obfs4"
4344
local obfs4_cert="$obfs4_dir/obfs4_cert"
@@ -80,6 +81,7 @@ EOL
8081
echo -e "${GREEN}obfs4 configuration file created at $obfs4_dir/obfs4.json${NC}"
8182
}
8283

84+
8385
start_obfs4() {
8486
echo -e "${YELLOW}Starting obfs4 service...${NC}"
8587
obfs4proxy -logLevel INFO -enableLogging &
@@ -119,7 +121,7 @@ nebula_menu() {
119121
echo "||__| \__| |_______||______/ \______/ |_______/__/ \__\ |"
120122
echo "| |"
121123
echo "+--------------------------------------------------------------+"
122-
echo -e "| Telegram Channel : ${MAGENTA}@AminiDev ${NC}| Version : ${GREEN} 6.5.2 ${NC} "
124+
echo -e "| Telegram Channel : ${MAGENTA}@AminiDev ${NC}| Version : ${GREEN} 7.0.0 ${NC} "
123125
echo "+--------------------------------------------------------------------------------+"
124126
echo -e "| Telegram Channel Sponsor : ${GREEN}VNodePro ${NC} "
125127
echo "+--------------------------------------------------------------------------------+"
@@ -148,52 +150,232 @@ find_last_tunnel_number() {
148150
echo $last_number
149151
}
150152

153+
iran_setup_ipv4() {
154+
echo -e "${YELLOW}Setting up IRAN server $1${NC}"
155+
156+
read -p "Enter IRAN IP : " iran_ip
157+
read -p "Enter Kharej IP : " kharej_ip
158+
read -p "Enter IPv4 Local : " ipv4_local
159+
160+
cat <<EOL > /etc/netplan/mramini-$1.yaml
161+
network:
162+
version: 2
163+
tunnels:
164+
tunnel0858-$1:
165+
mode: sit
166+
local: $iran_ip
167+
remote: $kharej_ip
168+
addresses:
169+
- $ipv4_local/24
170+
EOL
171+
netplan_setup
172+
sudo netplan apply
173+
174+
start_obfs4
175+
176+
cat <<EOL > /root/connectors-$1.sh
177+
ping ${ipv4_local%.*}.2
178+
EOL
179+
180+
chmod +x /root/connectors-$1.sh
181+
182+
screen -dmS connectors_session_$1 bash -c "/root/connectors-$1.sh"
183+
184+
# Unblock IPv4 local if blocked
185+
iptables -C INPUT -s $ipv4_local -j DROP 2>/dev/null && iptables -D INPUT -s $ipv4_local -j DROP
186+
187+
echo "IRAN Server $1 setup complete."
188+
echo -e "####################################"
189+
echo -e "# Your IPv4 : #"
190+
echo -e "# $ipv4_local #"
191+
echo -e "####################################"
192+
}
193+
194+
kharej_setup_ipv4() {
195+
echo -e "${YELLOW}Setting up Kharej server $1${NC}"
196+
197+
read -p "Enter IRAN IP : " iran_ip
198+
read -p "Enter Kharej IP : " kharej_ip
199+
read -p "Enter IPv4 Local : " ipv4_local
200+
201+
cat <<EOL > /etc/netplan/mramini-$1.yaml
202+
network:
203+
version: 2
204+
tunnels:
205+
tunnel0858-$1:
206+
mode: sit
207+
local: $kharej_ip
208+
remote: $iran_ip
209+
addresses:
210+
- $ipv4_local/24
211+
EOL
212+
netplan_setup
213+
sudo netplan apply
214+
215+
start_obfs4
216+
217+
cat <<EOL > /root/connectors-$1.sh
218+
ping ${ipv4_local%.*}.1
219+
EOL
220+
221+
chmod +x /root/connectors-$1.sh
222+
223+
screen -dmS connectors_session_$1 bash -c "/root/connectors-$1.sh"
224+
225+
# Unblock IPv4 local if blocked
226+
iptables -C INPUT -s $ipv4_local -j DROP 2>/dev/null && iptables -D INPUT -s $ipv4_local -j DROP
227+
228+
echo "Kharej Server $1 setup complete."
229+
echo -e "####################################"
230+
echo -e "# Your IPv4 : #"
231+
echo -e "# $ipv4_local #"
232+
echo -e "####################################"
233+
}
234+
235+
iran_setup_auto_ipv4() {
236+
echo -e "${YELLOW}Setting up IRAN server $1${NC}"
237+
238+
read -p "Enter IRAN IP : " iran_ip
239+
read -p "Enter Kharej IP : " kharej_ip
240+
241+
cat <<EOL > /etc/netplan/mramini-$1.yaml
242+
network:
243+
version: 2
244+
tunnels:
245+
tunnel0858-$1:
246+
mode: sit
247+
local: $iran_ip
248+
remote: $kharej_ip
249+
addresses:
250+
- $2/24
251+
EOL
252+
netplan_setup
253+
sudo netplan apply
254+
255+
start_obfs4
256+
257+
cat <<EOL > /root/connectors-$1.sh
258+
ping ${2%.*}.2
259+
EOL
260+
261+
chmod +x /root/connectors-$1.sh
262+
263+
screen -dmS connectors_session_$1 bash -c "/root/connectors-$1.sh"
264+
265+
# Unblock IPv4 local if blocked
266+
iptables -C INPUT -s $2 -j DROP 2>/dev/null && iptables -D INPUT -s $2 -j DROP
267+
268+
echo "IRAN Server $1 setup complete."
269+
echo -e "####################################"
270+
echo -e "# Your IPv4 : #"
271+
echo -e "# $2 #"
272+
echo -e "####################################"
273+
}
274+
275+
kharej_setup_auto_ipv4() {
276+
echo -e "${YELLOW}Setting up Kharej server $1${NC}"
277+
278+
read -p "Enter IRAN IP : " iran_ip
279+
read -p "Enter Kharej IP : " kharej_ip
280+
281+
cat <<EOL > /etc/netplan/mramini-$1.yaml
282+
network:
283+
version: 2
284+
tunnels:
285+
tunnel0858-$1:
286+
mode: sit
287+
local: $kharej_ip
288+
remote: $iran_ip
289+
addresses:
290+
- $2/24
291+
EOL
292+
netplan_setup
293+
sudo netplan apply
294+
295+
start_obfs4
296+
297+
cat <<EOL > /root/connectors-$1.sh
298+
ping ${2%.*}.1
299+
EOL
300+
301+
chmod +x /root/connectors-$1.sh
302+
303+
screen -dmS connectors_session_$1 bash -c "/root/connectors-$1.sh"
304+
305+
# Unblock IPv4 local if blocked
306+
iptables -C INPUT -s $2 -j DROP 2>/dev/null && iptables -D INPUT -s $2 -j DROP
307+
308+
echo "Kharej Server $1 setup complete."
309+
echo -e "####################################"
310+
echo -e "# Your IPv4 : #"
311+
echo -e "# $2 #"
312+
echo -e "####################################"
313+
}
314+
151315
install_tunnel() {
152-
nebula_menu "| 1 - IRAN \n| 2 - Kharej \n| 0 - Exit"
316+
nebula_menu "| 1 - IRAN \n| 2 - Kharej \n| 3 - IRAN (IPv4 Local) \n| 4 - Kharej (IPv4 Local) \n| 0 - Exit"
153317

154318
read -p "Enter option number: " setup
155319

156320
case $setup in
157-
1)
321+
1|3)
158322
read -p "How many servers: " server_count
159323
# Find the last tunnel number
160324
last_number=$(find_last_tunnel_number)
161325
next_number=$((last_number + 1))
162326

163-
echo -e "\n${GREEN}Choose IPv6 Local configuration:${NC}"
164-
echo "1- Enter IPV6 Local manually (recommended)"
165-
echo "2- Set IPV6 Local automatically"
166-
read -p "Enter your choice: " ipv6_choice
327+
echo -e "\n${GREEN}Choose IP configuration:${NC}"
328+
echo "1- Enter IP manually (recommended)"
329+
echo "2- Set IP automatically"
330+
read -p "Enter your choice: " ip_choice
167331

168332
for ((i=next_number;i<next_number+server_count;i++))
169333
do
170-
if [ "$ipv6_choice" = "1" ]; then
171-
iran_setup $i
334+
if [ "$ip_choice" = "1" ]; then
335+
if [ "$setup" = "1" ]; then
336+
iran_setup $i
337+
else
338+
iran_setup_ipv4 $i
339+
fi
172340
else
173-
auto_ipv6="fd25:2895:dc$(printf "%02d" $i)::1"
174-
iran_setup_auto $i "$auto_ipv6"
341+
if [ "$setup" = "1" ]; then
342+
auto_ipv6="fd25:2895:dc$(printf "%02d" $i)::1"
343+
iran_setup_auto $i "$auto_ipv6"
344+
else
345+
auto_ipv4="10.0.$(printf "%d" $i).1"
346+
iran_setup_auto_ipv4 $i "$auto_ipv4"
347+
fi
175348
fi
176349
done
177350
;;
178-
2)
179-
echo -e "\n${GREEN}Choose IPv6 Local configuration:${NC}"
180-
echo "1- Enter IPV6 Local manually (recommended)"
181-
echo "2- Set IPV6 Local automatically"
182-
read -p "Enter your choice: " ipv6_choice
351+
2|4)
352+
echo -e "\n${GREEN}Choose IP configuration:${NC}"
353+
echo "1- Enter IP manually (recommended)"
354+
echo "2- Set IP automatically"
355+
read -p "Enter your choice: " ip_choice
183356

184-
if [ "$ipv6_choice" = "1" ]; then
357+
if [ "$ip_choice" = "1" ]; then
185358
read -p "How many servers: " server_count
186359
# Find the last tunnel number
187360
last_number=$(find_last_tunnel_number)
188361
next_number=$((last_number + 1))
189362
for ((i=next_number;i<next_number+server_count;i++))
190363
do
191-
kharej_setup $i
364+
if [ "$setup" = "2" ]; then
365+
kharej_setup $i
366+
else
367+
kharej_setup_ipv4 $i
368+
fi
192369
done
193370
else
194-
read -p "What is the Kharej server number? " kharej_number
195-
auto_ipv6="fd25:2895:dc$(printf "%02d" $kharej_number)::2"
196-
kharej_setup_auto $kharej_number "$auto_ipv6"
371+
read -p "What is the server number? " server_number
372+
if [ "$setup" = "2" ]; then
373+
auto_ipv6="fd25:2895:dc$(printf "%02d" $server_number)::2"
374+
kharej_setup_auto $server_number "$auto_ipv6"
375+
else
376+
auto_ipv4="10.0.$(printf "%d" $server_number).2"
377+
kharej_setup_auto_ipv4 $server_number "$auto_ipv4"
378+
fi
197379
fi
198380
;;
199381

0 commit comments

Comments
 (0)