my_route/README.md

56 lines
1.7 KiB
Markdown
Raw Normal View History

2023-08-17 21:00:13 +03:00
# my_route
2023-08-17 20:52:55 +03:00
2023-08-17 21:00:13 +03:00
Route manager by CIDR lists
2023-08-17 21:56:49 +03:00
* [`my_route`.py](https://git.hmp.today/pavel.muhortov/my_route#my_route-py)
____
## `my_route`.py
**Description:**
> Route management by CIDR lists.
**Dependencies:**
>
> * privileged rights
> * [Python 3](https://www.python.org/downloads/) (tested version 3.9.5 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
2023-08-31 10:28:27 +03:00
> * [git](https://git-scm.com/) (tested version 2.30.2 on [Debian GNU/Linux 11](http://ftp.debian.org/debian/dists/bullseye/))
2023-08-17 21:56:49 +03:00
| PARAMETERS | DESCRIPTION | DEFAULT|
|-------------|-------------|--------|
|**[-h]**|print help and exit||
|**[--config]**|custom configuration file path|`./my_route.conf`|
|**[-a, --add]**|add routes specified by config|`False`|
|**[-d, --del]**|del routes specified by config|`False`|
|**[-i, --imitate]**|only showing commands without applying them|`False`|
|**[-u, --update]**|update cidr file db|`False`|
|**[-f, --force]**|force download sources for update|`False`|
2023-08-31 10:28:27 +03:00
### Example usage my_route.py
2023-08-17 21:56:49 +03:00
```bash
2023-08-31 10:28:27 +03:00
# download my_route.py
2023-08-17 21:56:49 +03:00
sudo wget https://git.hmp.today/pavel.muhortov/my_route/raw/branch/master/my_route.py -O /usr/local/bin/my_route.py
sudo chmod +x /usr/local/bin/my_route.py
```
```bash
2023-08-31 10:28:27 +03:00
# download and edit my_route.conf
2023-08-17 21:56:49 +03:00
sudo wget https://git.hmp.today/pavel.muhortov/my_route/raw/branch/master/my_route.conf -O /usr/local/bin/my_route.conf
sudo nano /usr/local/bin/my_route.conf
```
```bash
2023-08-31 10:28:27 +03:00
# create and edit cidr files or update by sources
2023-08-17 21:56:49 +03:00
sudo mkdir /usr/local/bin/my_route.db
sudo tee /usr/local/bin/my_route.db/sources/custom.cidr > /dev/null <<'EOF'
34.117.59.81/32 # ipinfo.io
EOF
```
```bash
# sudo crontab -e
2023-08-31 10:28:27 +03:00
0 0 * * * /usr/bin/python3 /usr/local/bin/my_route.py --update --force
2023-08-17 21:56:49 +03:00
```