2020-07-20 17:19:44 -04:00
|
|
|
# dl-router
|
|
|
|
|
router of download URLs
|
2020-07-25 22:22:11 -04:00
|
|
|
|
2020-11-29 20:24:25 -05:00
|
|
|
returns 302 to a mirror configured. Can manually select region.
|
|
|
|
|
|
2020-07-25 22:22:11 -04:00
|
|
|
currently designed for app folder to be mapped into a usgi container.
|
|
|
|
|
see sample launch script
|
|
|
|
|
`launch_redirect.sh`
|
|
|
|
|
|
|
|
|
|
expects `userdata.csv` in app folder.. map as needed.
|
2020-11-29 20:24:25 -05:00
|
|
|
expects `mirrors.yaml` in app folder.. map as needed
|
2020-07-25 22:22:11 -04:00
|
|
|
|
|
|
|
|
run local
|
|
|
|
|
```
|
|
|
|
|
cd app
|
|
|
|
|
export FLASK_APP=main
|
|
|
|
|
python -m flask run --host 0.0.0.0 --port 5000
|
|
|
|
|
```
|
|
|
|
|
|
2020-11-29 20:24:25 -05:00
|
|
|
## configuration
|
|
|
|
|
|
|
|
|
|
_see [examples](examples/) folder_
|
|
|
|
|
|
|
|
|
|
### modes
|
|
|
|
|
`redirect` - standard redirect functionality
|
|
|
|
|
`dl_map` - will attempt to use contents of userdata.csv to map downloads
|
|
|
|
|
### mirrors
|
|
|
|
|
mirror target with trailing slash is placed in a yaml list under a key for regions
|
|
|
|
|
### yaml configured
|
|
|
|
|
```yaml
|
|
|
|
|
---
|
|
|
|
|
mode: dl_map
|
|
|
|
|
NA:
|
|
|
|
|
- https://mirror1.example/images/
|
|
|
|
|
- https://mirror2.example/images/
|
|
|
|
|
EU:
|
|
|
|
|
- https://mirror3.example/weirdfolder/images/
|
|
|
|
|
- https://mirror4.example/many/sub/folders/images/
|
|
|
|
|
````
|
|
|
|
|
|
2020-07-25 22:22:11 -04:00
|
|
|
## API
|
|
|
|
|
|
|
|
|
|
`/status`
|
|
|
|
|
meant for simplee healtcheck. returns 200 OK
|
|
|
|
|
|
|
|
|
|
`/reload`
|
|
|
|
|
Flushes cache and reloads userdata file. Return JSON of what new userdata is
|
|
|
|
|
|
2020-11-29 20:24:25 -05:00
|
|
|
`/mirrors`
|
|
|
|
|
Shows all mirrors configured
|
|
|
|
|
|
|
|
|
|
`/regions`
|
|
|
|
|
Shows all mirror regions
|
|
|
|
|
|
|
|
|
|
`/dl_map`
|
|
|
|
|
shows download map for images
|
|
|
|
|
|
2020-12-19 23:04:45 -05:00
|
|
|
`/geoip`
|
|
|
|
|
show geoip info from requestor IP
|
|
|
|
|
|
2020-11-29 21:29:08 -05:00
|
|
|
`/region/REGIONCODE/`
|
2020-11-29 21:28:13 -05:00
|
|
|
will redirect to desired configurd regions:
|
|
|
|
|
NA - north america
|
|
|
|
|
EU - Europe
|
|
|
|
|
AS - Asia (currently China)
|