andresgongora / synth-shell-greeter

A system status report and your personal ASCII-art logo for your terminal sessions
GNU General Public License v3.0
13 stars 15 forks source link

Rethink and overhaul Local IPv4 and IPv6 display #10

Open olmari opened 5 years ago

olmari commented 5 years ago

We need to determine what we exactly mean by "local" in local IP-addresses, as even mine laptop has 2 "local" IPv4-addresses, one for wireless and one from virtual-machine host adapter.

With IPv6-addresses there can easily be 3-6 per adapter, link-local fe80:, local routable fd:, one gotten from DHCPv6 (statefull), one gotten from router-advertisment (stateless), and one from router-advertisment but randomly created... Not every address is allways there depending from configuration and avaibility, but even minimally there is usually 3 addresses, all considered "local"... and multiply by number of adapters you get quite an list quite fast...

So:

olmari commented 5 years ago

With IPv4 One option would be indeed to try figuring out an way to look up the IP-address that belongs to adapter and/or subnet that has default route pointing in it, but that doesn't make other possible IP-numbers not any less "local" nor unusable.

With IPv6 it is then even more "impossible" determination as every adapter can get trough its own "fe80:/0", and all variations of stateless and stateful are also equally usable, thus there is even less clear idea what we want to display as "local"

andresgongora commented 5 years ago

Feedback: for whatever reason the new version after the last update to develop, feels much faster

andresgongora commented 5 years ago

I found this snippet curl -sSL http://ipecho.net/plain | xargs echo

andresgongora commented 5 years ago

Determine what we actually wanna show/signal with "local" IP numbers, especially IPv6 How about we make it configurable to choose:

  1. First and last IPv6 segments in the local and external IP fields External IP 56.123.23.41, 45ef:::9f8a

  2. Print IPv6 in a separate line below the log, that way we have all the width of the terminal.

  3. Add a separate entry next to the logo for IPv6 local and external only, but only display part of it (imagine you have several machines on a big network, usually you, as a sysadmin, can identify them with only part of the IP, that that's more than enough). This will be easier once andresgongora/synth-shell#52 is in place.

olmari commented 5 years ago

Well... cutting half away fom ipv6 is same as not showing it at all... Also external ipv6 is easy in itself, there is ever only one reported at one time.. "only" local is the thing that is a mess...

I'm not against having all those and even more as an option, but from these option 2 is.at least.most sane default :)

Also for point 3, sure we could show only latter part of ipv6, but again we don't know how much.. we could try to calculate suffix length from reported subnet length but even that doesn't always tell dies upstream router have bigger subnet and thus part of wanted portion.. so not easy to figure out that at least behalf of anyone...

andresgongora commented 5 years ago

I agree, option 2 should be default

andresgongora commented 5 years ago

Look at this screenshot from @fikoborizqy . As soon as you have more than one IP, it becomes very ugly