[RFC] get ip addresses through connectivity manager, and get gateway ip as well#753
Open
Grimler91 wants to merge 2 commits intotermux:masterfrom
Open
[RFC] get ip addresses through connectivity manager, and get gateway ip as well#753Grimler91 wants to merge 2 commits intotermux:masterfrom
Grimler91 wants to merge 2 commits intotermux:masterfrom
Conversation
We can then get all the ipv4 and ipv6 addresses, and do not have to
use the deprecated Formatter.formatIpAddress.
Returns something like:
```
$ termux-wifi-connectioninfo
{
"ip": "fe80::7cf7:74ff:fe65:52be",
"ip": "192.168.1.224",
"ip": "fd6e:e697:d22e:0:7cf7:74ff:fe65:52be",
"ip": "fd6e:e697:d22e:0:d536:328f:b0f:1a32",
"bssid": "02:00:00:00:00:00",
"frequency_mhz": 2452,
"link_speed_mbps": 78,
"mac_address": "02:00:00:00:00:00",
"network_id": -1,
"rssi": -57,
"ssid": "<unknown ssid>",
"ssid_hidden": false,
"supplicant_state": "COMPLETED"
}
```
Getting the gateway address can be useful. One use-case is for easily ssh'ing into a device providing a hotspot, in which case one should ssh to the gateway ip.
Member
|
I do not agree with having multiple values for the same key. Most JSON tools including jq are just going to end up with just one value for the ip key, maybe we could go with keeping the older ip key and have a separate array, ips containing all these details |
|
How about adding two new props: It can handle multiple ipv4 or ipv6 addresses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Through connectivity manager we can get both ipv4 and ipv6 addresses, and can drop the use of the deprecated
Formatter.formatIpAddress().With both changes we get something like:
Going from just one ip field to several will likely break some user scripts though. Maybe we should keep printing the IPV4 address as
"ip" : ...and then all of them as"ip 1" : ...,"ip 2" : ...and so on?