Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/refraction-ray/simple-ddns
A lightweight flask app with ddns-like utilities
https://github.com/refraction-ray/simple-ddns
ddns flask
Last synced: 29 days ago
JSON representation
A lightweight flask app with ddns-like utilities
- Host: GitHub
- URL: https://github.com/refraction-ray/simple-ddns
- Owner: refraction-ray
- License: mit
- Created: 2019-04-11T03:49:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-25T22:34:32.000Z (over 3 years ago)
- Last Synced: 2023-03-03T12:36:22.765Z (over 1 year ago)
- Topics: ddns, flask
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Usage
## Server side
Just `./run.sh` or use gunicorn to run the flask app if you like.
### Configurations
One can change the default configuration in `config.yaml` or write in `config_override.yaml` to overwrite the corresponding default options.
* CACHE_TYPE: `simple`, `fs` and `redis` are supported, which utilize memory, file and redis db as cache backend respectively. If fs or redis cache is configured, further cache related options should be set, see `app/cache.py` for details.
* CACHE_TIMEOUT: the storage time of ip address, 0 for no time out
* AUTH_SALT: the password for ip registration.
* TIME_ZONE: keep the server and client sync when talking about time, eg. 8 for Asia/Beijing
* PROXY_SETTING: 0 for no proxy, 1 for nginx as the reverse proxy of the app, remember editing the config of nginx to add the line `proxy_set_header X-Real-IP $remote_addr;` in the corresponding server part.
* CACHE_KEY: no real meaning, any string to avoid key collsion for general usage
* LOG_ITEMS: determine how many items are recorded as history change## Client side
Firstly, one should make sure python package click and requests as well as *nix CLI tool curl and jq are installed on your system.
To notify your ip with the server, try `python3 client/regip.py -h hostname -s serverip -p authcode`.
You can add this command to crontab to keep the server sync with the ip address of local machines.
Getting the ip of given host is as simple as `curl -s serverip/api/query/hostname|jq --raw-out .ip`.
If you want to update your hosts according to the server records, try `sudo python3 client/updatehosts.py -s serverip`. And if you make both tasks - push ip to the server (regip.py) and pull ip from the server (updatehosts.py) both as crontab tasks, then you can always use hostname to achieve network relevant tasks just as ddns without worrying ip changing.
On the other hand, you can also add `serverip/api/source` as a cloud hosts to softwares supporting this feature, eg. SwitchHosts.
*Note: serverip should include the protocol head, i.e `http://` or `https://`. For example, serverip can be in the form https://example.com or http://8.8.8.8*.