Giter Site home page Giter Site logo

ddns-on-cloudflare's Introduction

๐Ÿ‘‹ Hello, I'm Nikhil John

Developer | Designer | Gemologist | Photographer

learn go

nikhiljohn10

  • ๐Ÿ”ญ Iโ€™m currently working on freelance project for Better Housing.

  • ๐Ÿง  I'm currently learning Go Language.

  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on pi-clap and Ripples

  • ๐Ÿฆฆ I'm also code owner of Goozt(Go Langauge Projects)

  • ๐Ÿ’ฌ Ask me about anything. I'm a fast learner. I'm open to share what I have learnt.

  • ๐Ÿ“ซ How to reach me -> [email protected]

Find me with:

nikzjon nikzjon nikzjon 2382813/nikzjon nikzjon nikzjon

nikzjon

๐Ÿ’ป Technologies Explored
Go Python Swift TypeScript JavaScript NodeJS ReactJS Docker Terraform Jupyter Bash Script LaTeX
โญ Github Stats

Top Langs Dark Top Langs Light Anurag's GitHub stats-Dark Anurag's GitHub stats-Light

๐Ÿ’ก Language Timeline

learn go

ddns-on-cloudflare's People

Contributors

nikhiljohn10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ddns-on-cloudflare's Issues

Unable to compile pyinstaller

Alle the times I try to run the setup script end up with this error:

Building wheels for collected packages: pyinstaller
  Building wheel for pyinstaller (PEP 517) ... error
  Complete output from command /usr/bin/python2.7 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmppUVywX:
  running bdist_wheel
  running build
  running build_bootloader
  No precompiled bootloader found. Trying to compile it for you ...
  Setting top to                           : /tmp/pip-install-HSQsFw/pyinstaller/bootloader
  Setting out to                           : /tmp/pip-install-HSQsFw/pyinstaller/bootloader/build
  Python Version                           : 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
  Checking for 'gcc' (C compiler)          : not found
  Checking for 'clang' (C compiler)        : not found
  Checking for 'icc' (C compiler)          : not found
  could not configure a C compiler!
  (complete log in /tmp/pip-install-HSQsFw/pyinstaller/bootloader/build/config.log)
  ERROR: Failed compiling the bootloader. Please compile manually and rerun setup.py

  ----------------------------------------
  Failed building wheel for pyinstaller
  Running setup.py clean for pyinstaller
Failed to build pyinstaller
Could not build wheels for pyinstaller which use PEP 517 and cannot be installed directly
root@DietPi:/opt#

Edit: grammar

Unable to find Cloudflare User-Service-Key

Hi,
I wish to use your script to automate updating my ddns on Cloudflare but I keep getting the log messages below because I think I dont have the Cloudflare user service key.
Is this key still provided by cloudflare as I can only see my Global API and Origin CA keys under my dashboard? Is there a workaround if this key is no longer provided by cloudflare?

./setup.sh: line 19: pip: command not found
./setup.sh: line 20: pip: command not found
./setup.sh: line 21: pip: command not found
./setup.sh: line 36: pyinstaller: command not found
cp: cannot stat './dist/main': No such file or directory
Setting up systemd service
cp: cannot stat 'ddns': No such file or directory
Created symlink from /etc/systemd/system/multi-user.target.wants/ddns.service to /lib/systemd/system/ddns.service.
./setup.sh: line 69: pip: command not found
Setup completed successfully
โ— ddns.service - DDNS on Cloudflare
Loaded: loaded (/lib/systemd/system/ddns.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2019-02-20 21:08:25 GMT; 14ms ago
Process: 19877 ExecStart=/usr/sbin/ddns /opt/ddns-on-cloudflare (code=exited, status=203/EXEC)
Main PID: 19877 (code=exited, status=203/EXEC)

Feb 20 21:08:25 nathan systemd[1]: ddns.service: Unit entered failed state.
Feb 20 21:08:25 nathan systemd[1]: ddns.service: Failed with result 'exit-code'.

It should set IP on first run

Great script, but I think there's one huge flaw in it that makes it unusable in any real scenario. Or in a lot of them at least. I've tweaked it for myself, but here it is:

Right now it seems to not change IP when it's first launches. I believe this is wrong.

Imagine this scenario:
I've set everything up at home (say, video surveilance system on raspberry pi), and then unplugged everything and moved it to another location. I plug it back in and naturally I will get assigned a new IP. But ddns script will not change it until the NEXT change. So it can stay on that IP for as long as.... well maybe until it reboots even, depending on how long lease time for IP is.

Fix is simple. Don't run self.get_ip() on __init__.

class DDNS(object):
	def __init__(self,secret_path):
		super(DDNS, self).__init__()
		zone_name, email, token, certtoken = secrets.get(secret_path)
		self.zone_name = zone_name
		self.ip='0.0.0.0'
		self.dns = CloudFlare.CloudFlare(email = email, token = token, certtoken = certtoken)
		#self.get_ip() # Comment this line out
		self.get_zone_id()
		self.get_record_id()
		self.update_dns()
		self.worker()

Another option would be to write IP to disk, not just keeping it in RAM. This way even after reboot it will be able to check if IP changed or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.