Closed piramiday closed 2 months ago
There isn't a get
for this information right now, but it's possible using the dump daemon-state
unstable command. That's considered "unstable" just because the JSON format may change in future releases, it usually doesn't change that much though.
Try piactl -u dump daemon-state | jq '.connectedConfig.vpnLocation'
- you can also tack on .name
to jq if you just want the name, the "friendly names" generated by piactl come from the display names (lowercased and with non-alpha chars replaced by -
)
It's pretty easy to add gets if you'd like to take a look - one was just added in #15 , I'm sure we'll take a look at some point (there are a lot we'd like to add) but I'm not sure precisely when I'll get this into our schedule. In this case you'd be looking for client.connection().state.vpnLocation()
, and there should be machinery in the get command to render the pretty name from that location object.
it does not look like .name
is there anymore, should I look someplace different?
user@host: ~$ piactl --version
3.5.1+07760
user@host:~$ piactl -u dump daemon-state | jq .connectedConfig.vpnLocation
{
"autoSafe":
"dedicatedIp":
"geoLocated":
"hasShadowsocks":
"id":
"latency":
"offline":
"portForward":
}
(I removed all values after the :
sign, so that is not valid JSON anymore.)
Hello! I believe the field you are looking for is "id"
. Is that what you were looking for?
This is the output of the command and it contains the region name (even when connected to auto)
$ piactl -u dump daemon-state | jq .connectedConfig.vpnLocation
{
"autoSafe": true,
"dedicatedIp": "",
"geoLocated": false,
"hasShadowsocks": false,
"id": "uk_southampton",
"latency": 59,
"offline": false,
"portForward": true
}
I did find another bug while looking at this though, "portForward"
is always true so will make a ticket for that :)
there used to be a name
which was user-friendlier, but sure, id
can be used to extract roughly the same information.
running the latest PIA application on a headless server.
if I set the region to
auto
, how can I get the actual region I'm being connected to?on the GUI it would show the region in parentheses, e.g.
VPN Server: Auto (US California)
. on the command linepiactl get region
just returnsauto
, which does not help at all.