Skip to content

Commit

Permalink
Merge pull request #12 from DennoN-RUS/V3.8.0-bird2
Browse files Browse the repository at this point in the history
V3.8.0 bird2
  • Loading branch information
DennoN-RUS authored Jun 13, 2023
2 parents 3e83f3b + 304a8da commit f00e47f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

protocol bgp antifilter {
table route_vpn1;
import all;
export none;
local as 64999;
neighbor BPGIPINPUT as BGPASINPUT;
multihop;
hold time 240;
ipv4 {
table route_vpn1;
import all;
export none;
};
}
8 changes: 4 additions & 4 deletions Install/common/func.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ROUTE_FORCE_VPN1=$SYSTEM_FOLDER/etc/bird4-force-vpn1.list
ROUTE_FORCE_VPN2=$SYSTEM_FOLDER/etc/bird4-force-vpn2.list
ROUTE_BASE_VPN=$SYSTEM_FOLDER/etc/bird4-base-vpn.list
ROUTE_USER_VPN=$SYSTEM_FOLDER/etc/bird4-user-vpn.list
BIRD_CONF=$SYSTEM_FOLDER/etc/bird4.conf
BIRD_CONF=$SYSTEM_FOLDER/etc/bird.conf
VPNTXT=$HOMEPATH/lists/user-vpn.list
VPN1TXT=$HOMEPATH/lists/user-vpn1.list
VPN2TXT=$HOMEPATH/lists/user-vpn2.list
Expand Down Expand Up @@ -111,10 +111,10 @@ ipr_func() {
#RESTART BIRD FUNCTION
restart_bird_func() {
if [[ "$DEBUG" == 1 ]]; then echo -e "\n########### $(date) STEP_5: restart bird ###########\n" >&2; fi
if [ "$(cat $MD5_SUM)" != "$(md5sum $SYSTEM_FOLDER/etc/bird4*)" ]; then
md5sum $SYSTEM_FOLDER/etc/bird4* > $MD5_SUM
if [ "$(cat $MD5_SUM)" != "$(md5sum $SYSTEM_FOLDER/etc/bird*)" ]; then
md5sum $SYSTEM_FOLDER/etc/bird* > $MD5_SUM
echo "Restarting bird"
killall -s SIGHUP bird4
killall -s SIGHUP bird
fi
}

Expand Down
34 changes: 21 additions & 13 deletions Install/double_vpn/bird4.conf → Install/double_vpn/bird.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ log stderr all;

router id IDINPUT;

table route_force;
table route_vpn1;
table route_vpn2;
ipv4 table route_force;
ipv4 table route_vpn1;
ipv4 table route_vpn2;

protocol direct { interface "VPN1INPUT", "VPN2INPUT"; }
protocol device { scan time 15; }

template kernel KERNEL_BASE {
learn;
scan time 60;
import none;
ipv4 { import none; };
}

filter pref_50_force {
preference = 50;
accept;
Expand All @@ -30,29 +32,35 @@ filter pref_150_vpn2 {
}

protocol kernel kernel_force from KERNEL_BASE {
export filter pref_50_force;
table route_force;
kernel table 1000;
ipv4 {
table route_force;
export filter pref_50_force;
};
}
protocol kernel kernel_vpn1 from KERNEL_BASE {
export filter pref_100_vpn1;
table route_vpn1;
kernel table 1001;
ipv4 {
export filter pref_100_vpn1;
table route_vpn1;
};
}
protocol kernel kernel_vpn2 from KERNEL_BASE {
export filter pref_150_vpn2;
table route_vpn2;
kernel table 1002;
ipv4 {
export filter pref_150_vpn2;
table route_vpn2;
};
}

protocol static static_force {
table route_force;
ipv4 { table route_force; };
include "bird4-force-isp.list";
include "bird4-force-vpn1.list";
include "bird4-force-vpn2.list";
}
protocol static static_vpn {
table route_vpn1;
protocol static static_vpn1 {
ipv4 { table route_vpn1; };
include "bird4-base-vpn.list";
include "bird4-user-vpn.list";
}
Expand Down
30 changes: 20 additions & 10 deletions Install/install_func.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ install_packages_func(){
$SYSTEM_FOLDER/bin/opkg update
$SYSTEM_FOLDER/bin/opkg upgrade busybox
# Installing packages
$SYSTEM_FOLDER/bin/opkg install bird1-ipv4 curl cron bind-dig bind-libs iprange whois diffutils patch
$SYSTEM_FOLDER/bin/opkg install bird2 bird2c curl cron bind-dig bind-libs iprange whois diffutils patch
}

# Create start folders
Expand All @@ -14,10 +14,20 @@ create_folder_func(){

# Stop service if exist
stop_func(){
# Stop and remove old bird if exist
if [ -f "$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4" ]; then
echo "Stop bird"
$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop
$SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird1-ipv4
rm $SYSTEM_FOLDER/etc/bird4.conf
install_packages_func
fi
# Stop bird2
if [ -f "$SYSTEM_FOLDER/etc/init.d/S70bird" ]; then
echo "Stop bird2"
$SYSTEM_FOLDER/etc/init.d/S70bird stop
fi
# Stop table service
if [ -f "$SYSTEM_FOLDER/etc/init.d/S02bird-table" ]; then
echo "Stop bird-table"
$SYSTEM_FOLDER/etc/init.d/S02bird-table stop
Expand Down Expand Up @@ -78,10 +88,10 @@ fill_folder_and_sed_func(){

# Copying the bird configuration file
copy_bird_config_func(){
if [ ! -f "$SYSTEM_FOLDER/etc/bird4.conf-opkg" ]; then
mv $SYSTEM_FOLDER/etc/bird4.conf $SYSTEM_FOLDER/etc/bird4.conf-opkg;
if [ ! -f "$SYSTEM_FOLDER/etc/bird.conf-opkg" ]; then
mv $SYSTEM_FOLDER/etc/bird.conf $SYSTEM_FOLDER/etc/bird.conf-opkg;
fi
cp $HOME_FOLDER/Install/$CONFFOLDER/bird4.conf $SYSTEM_FOLDER/etc/bird4.conf
cp $HOME_FOLDER/Install/$CONFFOLDER/bird.conf $SYSTEM_FOLDER/etc/bird.conf
}

# Select mode
Expand Down Expand Up @@ -125,7 +135,7 @@ configure_file_mode_func(){
# BGP mode
configure_bgp_mode_func(){
configure_file_mode_func
cat $HOME_FOLDER/Install/common/bird4-bgp.conf >> $SYSTEM_FOLDER/etc/bird4.conf
cat $HOME_FOLDER/Install/common/bird-bgp.conf >> $SYSTEM_FOLDER/etc/bird.conf
if [ "$1" != "-u" ] && [ -z "$BGP_IP" ] && [ -z "$BGP_AS" ]; then
echo -e "Which BGP service do you want to use\n 1 - antifilter.download 45.154.73.71 (default) \n 2 - antifilter.network 51.75.66.20 \n 3 - antifilter.network with vpn 10.75.66.20 ( you need install vpn first https://antifilter.network/vpn )"
read BGP
Expand All @@ -138,7 +148,7 @@ configure_bgp_mode_func(){
fi
fi
echo -e "You are select BGP $BGP_IP AS$BGP_AS"
sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SYSTEM_FOLDER/etc/bird4.conf
sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SYSTEM_FOLDER/etc/bird.conf
sed -i 's/BPGIPINPUT/'$BGP_IP'/; s/BGPASINPUT/'$BGP_AS'/' $SCRIPTS/*.sh
}

Expand All @@ -162,7 +172,7 @@ config_isp_func(){
ISP_IP="123.123.123.123";
fi
sed -i 's/ISPINPUT/'$ISP'/' $SCRIPTS/*.sh
sed -i 's/IDINPUT/'$ISP_IP'/' $SYSTEM_FOLDER/etc/bird4.conf
sed -i 's/IDINPUT/'$ISP_IP'/' $SYSTEM_FOLDER/etc/bird.conf
}

# Config VPN1
Expand All @@ -173,7 +183,7 @@ config_vpn1_func(){
fi
echo "Your are select VPN1 $VPN1"
sed -i 's/VPN1INPUT/'$VPN1'/' $SCRIPTS/*.sh
sed -i 's/VPN1INPUT/'$VPN1'/' $SYSTEM_FOLDER/etc/bird4.conf
sed -i 's/VPN1INPUT/'$VPN1'/' $SYSTEM_FOLDER/etc/bird.conf
}

# Config VPN2
Expand All @@ -184,7 +194,7 @@ config_vpn2_func(){
fi
echo "Your are select VPN2 $VPN2"
sed -i 's/VPN2INPUT/'$VPN2'/' $SCRIPTS/*.sh
sed -i 's/VPN2INPUT/'$VPN2'/' $SYSTEM_FOLDER/etc/bird4.conf
sed -i 's/VPN2INPUT/'$VPN2'/' $SYSTEM_FOLDER/etc/bird.conf
}

# Organizing scripts into folders
Expand All @@ -206,6 +216,6 @@ run_func(){
$SYSTEM_FOLDER/etc/init.d/S02bird-table restart
$SCRIPTS/add-bird4_routes.sh -i
$SYSTEM_FOLDER/etc/init.d/S10cron restart
$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 restart
$SYSTEM_FOLDER/etc/init.d/S70bird restart
$SCRIPTS/add-bird4_routes.sh
}
28 changes: 17 additions & 11 deletions Install/one_vpn/bird4.conf → Install/one_vpn/bird.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ log stderr all;

router id IDINPUT;

table route_force;
table route_vpn1;
ipv4 table route_force;
ipv4 table route_vpn1;

protocol direct { interface "VPN1INPUT"; }
protocol device { scan time 15; }

template kernel KERNEL_BASE {
learn;
scan time 60;
import none;
ipv4 { import none; };
}

filter pref_50_force {
preference = 50;
accept;
Expand All @@ -24,22 +26,26 @@ filter pref_100_vpn1 {
}

protocol kernel kernel_force from KERNEL_BASE {
export filter pref_50_force;
table route_force;
kernel table 1000;
ipv4 {
table route_force;
export filter pref_50_force;
};
}
protocol kernel kernel_vpn from KERNEL_BASE {
export filter pref_100_vpn1;
table route_vpn1;
protocol kernel kernel_vpn1 from KERNEL_BASE {
kernel table 1001;
ipv4 {
table route_vpn1;
export filter pref_100_vpn1;
};
}

protocol static static_force {
table route_force;
ipv4 { table route_force; };
include "bird4-force-isp.list";
include "bird4-force-vpn1.list";
}
protocol static static_vpn {
table route_vpn1;
protocol static static_vpn1 {
ipv4 { table route_vpn1; };
include "bird4-base-vpn.list";
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Bird4Static
Здесь выложены файлы для работы bird4 с сервисами antifilter.download или antifilter.network
Здесь выложены файлы для работы bird с сервисами antifilter.download или antifilter.network

Есть 3 режима работы - скачивание файла с нужного сервиса, установка бгп соединения с одним из сервисов, и работа только с пользовательскими файлами

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

VERSION="v3.7.1"
VERSION="v3.8.0"

while true; do
echo -e "\nBegin install? y/n"
Expand Down
11 changes: 8 additions & 3 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ while true; do

# Stop Services
$SYSTEM_FOLDER/etc/init.d/S02bird-table stop
$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop
if [ -f "$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4" ]; then
$SYSTEM_FOLDER/etc/init.d/S04bird1-ipv4 stop
$SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird1-ipv4
fi
if [ -f "$SYSTEM_FOLDER/etc/init.d/S70bird" ]; then
$SYSTEM_FOLDER/etc/init.d/S70bird stop
$SYSTEM_FOLDER/bin/opkg --force-removal-of-dependent-packages remove bird2
fi

# Remove packages
# bird
$SYSTEM_FOLDER/bin/opkg remove bird1-ipv4
# curl
answer=0; echo "Do you want remove 'curl'? 0 - no 1 - yes (default: no)"; read answer
if [ "$answer" = "1" ]; then $SYSTEM_FOLDER/bin/opkg remove curl; fi
Expand Down

0 comments on commit f00e47f

Please sign in to comment.