-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for IPv6 / AAAA records and updated base code #60
base: main
Are you sure you want to change the base?
Conversation
In addition, IPv4 and IPv6 regular expressions, code formatting, and descriptive comments have been updated.
Global variable tab indentation fixed.
Migrated two lines of code for logging further below.
Changed proxy variable from "false" to "true" to improve security against DDoS attacks.
Nice work! I also like that you expanded the comments to make them more clear. Question is it worth setting a block to see if the ipv4 is valid before checking ipv6? Do we need create/update records for both versions? And a follow up can we just set one ip variable to be used throughout the rest of the script instead of checking both ip variables throughout? |
Absolutely! I can clarify a few things on that. First, for setting a block to see if the IPv4 is valid before checking IPv6, my intention with that was to allow the script to continue running even if an IPv4 address or an IPv6 address was not pulled from a website. This may or may not be the best way to do that, though that is what I've done here. There may be a cleaner method than what I wrote to accomplish the same goal, though as a disclaimer, I am fairly new to bash scripting and I cannot say for certain. To continue, to answer your second question regarding creating and updating records for both versions, as that's already what the script is accomplishing with the A records, I've simply added on to that by extending out the same functionality to the AAAA records as well. Finally, for setting one IP variable to be used throughout the rest of the script instead of checking both IP variables throughout the script, I'm unsure about what you mean by that. Can you please clarify which variables you're referring to? As both the IPv4 (A record) and IPv6 (AAAA record) protocols utilize different regular expressions and IP addressing formats, I felt that it was best to keep them both separated from each other? Were you referring to the validity checks utilized for exiting the script after each PULL and GET section(s) of the code? I simply included these checks to ensure that the script exited cleanly before proceeding on and executing additional unnecessary checks and external connections out to Cloudflare. Thank you, ndrone-kr! |
To add on to my previous comment, it certainly would've been possible (and albeit, a lot easier) to keep the code separated between two different bash scripts. As in, one script for IPv4 (A records) and another for IPv6 (AAAA records). However, I felt that it would be more preferred to include both, as having only a singular script performing the job of two is often the more preferred option by users. In addition, IPv6 is quickly becoming the new standard while IPv4 is quickly being phased out during this transition phase. In my honest opinion, it makes a lot more sense to integrate and begin utilizing IPv6 addressing at some point or another while we're moving forward. With that said though, I can certainly understand the different use cases and alternative option of utilizing two scripts instead of one that other users may prefer to choose to utilize instead. Thoughts on that? |
Honestly I don't know the correct course of action. Honestly they were just questions that popped into my head while reviewing your code. I do like the idea of separate scripts or one main script that then loads functions in from a separate file. So one file contains the IPv4 functions, and a second file contains the IPv6 functions. Then the main script takes a flag of which version of IP addresses you are using. Don't feel like have to make changes based on what I stated. I'm not the owner of this repository. I'm just brain dumping what comes out of my head.
|
Those were some good questions! I also appreciate the idea of having additional options available to users through the usage of separate scripts and loading of functions from separate files for the sake of modularity. Though having said that, I personally feel that the separation would make the flow of the current script a bit more complex than it already is or has to be. I hope that makes sense. Personally speaking, I am also leaning more towards the inclusion of both types of IP addressing within a singular script. However, I am uncertain as to whether the available options mentioned here would match up with the desired outcome or original intentions of the owner of this repository. As in, for there to be a split between multiple scripts, or for there to be inclusion of two different types of IP addressing and DNS records within a singular script. I will await additional comments from @K0p1-Git in that regard. In the meantime, I will continue to keep my pull request open for review and my forked repository viewable to the public as a few other users and contributors here have already done. Thank you your feedback! |
Hi, thanks for your contribution! I just wanna point out quickly that getting our public ipv6 address from external sources isn't going to work for distros or devices that have privacy extensions enabled. In cases of privacy extensions, a random and temporary ip address will be used for outbound connection, meanwhile a static (like generated with a SLAAC token) one will be used for inbound connection. My current solution is like below: Entire source: here ip=$(ip -6 address show scope global primary -deprecated | grep -oE ${regex_ipv6}) To keep you up to speed:
This also works for environments with no privacy extensions enabled too! Therefore, it may help us to eliminate the need of relying on external websites to return our public IPv6 address! (but still keep the way we verify that a valid IPv6 connection is present) |
As described in the title. In addition, IPv4 and IPv6 regular expressions, code formatting, and descriptive comments have all been cleaned up and updated. Please feel free to contribute feedback on these changes, review the commits, and personally add any finishing touches or edits to the pull request. Lastly, if any of the commits are unneeded or instead should be migrated to an issue, please let me know! It's certainly possible that some or all of the new code written here can be integrated into the main branch. Thank you!