cetteup / update-plex-ipv6-access-url

DynDNS-like tool for keeping your Plex IPv6 custom access URL up to date
MIT License
44 stars 7 forks source link

Option to select IPv6 temporary or secured #23

Closed SMunroe69 closed 10 months ago

SMunroe69 commented 11 months ago

When I run an ifconfig, I have the following: en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM> ether 20:a5:cb:d1:b4:7f inet6 xxxx::xxx:xxxx:xxxx:42b2%en1 prefixlen 64 secured scopeid 0x12 inet 192.168.178.32 netmask 0xffffff00 broadcast 192.168.178.255 inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:a28a:683c prefixlen 64 autoconf secured inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:f523:d9cf prefixlen 64 autoconf temporary nd6 options=201<PERFORMNUD,DAD> media: autoselect status: active My DDNS uses the temporary all the time, and this tool will use the secured (more permanent address). Would it be possible to add an option to select the temporary IPv6 over the secured?

cetteup commented 11 months ago

Good question. Will have to check if I could detect the difference in the code.

Is there any particular reason for using the temporary address over the other one?

SMunroe69 commented 11 months ago

My DDNS updates to its provider using the temporary IPv6 address. If I could get the Plex updater to match the IP address that my DDNS service uses, then I should be able to access my Plex library outside my local network. Hopefully.

cetteup commented 11 months ago

Looks like these I am not able to detect any difference between these two addresses using the Go library.

Few questions:

  1. Could you post the output of ip a instead of ifconfig (masking IPs ofc)?
  2. Do both addresses work? As in, can you actually send data via either address?
  3. Does either address always have the same IPv6 prefix?
  4. Do the addresses always have the same order (is the temp one always the 2nd)?
  5. Would adding custom access domains for both addresses be of any help?
SMunroe69 commented 10 months ago
  1. Unfortunately, the command ip isn't standard in macOS.
  2. Both addresses can work. If I do an nslookup of the IPv6 of both the secured and temporary addresses, they can trace back to my custom DDNS name.
  3. Yes, the first four blocks remain the same.
  4. When I perform an ifconfig command, the addresses are always listed as secured first, then temporary.
  5. Could you provide more details? I'm not exactly sure what you're asking, but I certainly want to try and help.
cetteup commented 10 months ago

Regarding 5.: I was considering adding a command line flag like -use-address which could be first, last or all. First/last only add a custom access URL for the first/last IPv6 address on the interface. All would add one custom access URL per IPv6 address found on the interface.

Going by the answers to the other questions, I recon either -use-address last or -use-address all could work for your scenario?

SMunroe69 commented 10 months ago

That command could work, I think. When I run ifconfig, it lists the temporary IPv6 address first, then the permanent. Maybe instead of -use-address all it could be -use-address any for those that don't need to define one specifically. I'm not sure where the use case would call for -use-address all.

Just for info, when I visit ip6only.me, the IP returned is always the "temporary" IP.

Thank you for your help here!

cetteup commented 10 months ago

The default would be first, which is what it's currently doing: Use the first usable IPv6 address it finds on the given interface. any would work just as well, but it's a little less indicative of the actual behavior of the tool.

all would put the work on the client. Plex tries all possible ways of connecting to a server. So if you have multiple custom access URLs, it will use whichever works. Meaning by just blindly adding IPv6 custom access URLs for every IPv6 address on an interface, the Plex client would just have more options to try. Could be useful if you don't really know which IPv6 address to use and/or if the addresses are not always in the same order.

Regarding the ip6only.me hint: I looked into how go internally selects the local address to use. Turns out there's an RFC for it. I need to look into it a bit further, but for now I'll add the three options as mentioned above.

cetteup commented 10 months ago

Released as part of 0.3.0.