VPN Manager for OpenVPN

  • Whatever the VPN info dialog calls to display the DNS and IP address can you use the same call for skin someway?


    I don't know much about APIs unfortunately only know about skinning.


    A home property or function would be good to test.


    Thanks

  • Do you plan on checking it frequently as the IP changes with each connection, which if you're filtering is pretty often

  • Do you plan on checking it frequently as the IP changes with each connection, which if you're filtering is pretty often

    I only use one VPN connection throughout. No filtering. Using PIA I always connect to same ovpn so address wouldn't change much.

  • I've looked at the code, here are the issues:


    The inquiry to determine the IP can take some small number of seconds (or longer if the provider is AWOL).


    I could store the IP address on the home window when I do the inquiry, but if the connection happens on boot/start up then the inquiry doesn't happen (by design) so the IP address isn't known.


    You can switch on the enhanced display option to force the inquiry to happen, but your skin would need to recognise that the IP wouldn't be on the home window until after the inquiry has happened (can be some large number of second after startup has happened) - it would be an empty string if it's not connected.


    If the connection is disconnected, then the inquiry won't be run to show your updated external IP address.


    Or I could write an API to force the current IP address to be written to the home window, but it could take 10 second to execute. I guess I could also indicate whether it's connected to a VPN or not, but I don't think you care about this anyway.


    I think an API is the best way having looked. The API is documented on the wiki so you can look to see if you can integrate with it - I think it'd just boil down to a function call anyway. The other ways are plagued with issues. Does this work for you, even given the delay?

  • Thanks for the info.


    Sounds good I don't mind if there is a delay when displaying the IP.


    I don't have the VPN set to start on boot anyways. I turn it on when I need it using the connect API mapped to button.


    Having the isp IP show when disconnected would be good to have too.


    Also like you mentioned I would like to have label saying if vpn connected or not like it does in VPN dialog (green label on red off).


    So if the function calls is the easiest to implement that would do fine.


    Thanks

  • Hi Zomboided,

    Would it be possible to key map a remote button to bring up the "Change or disconnect VPN connection" selection (a complete list of all my connection options)? With NordVPN there must be around 20 Atlanta servers to choose from. And, while at on given time, one connection may not be very congested, within an hour it's at near capacity...which brings on freezing and buffering.


    NordVPN is a good VPN, no doubt, but with their Windows/Android software, which chooses the least congested connection automatically, it can be a pain for us Kodi Pi users.


    Later...

    Bob

  • the_bo install 4.1.7, you'll need to get it from GitHub as it's not on the repo (as it's not interesting for most people) and the API is documented on the wiki. It's vaguely tested, but if you see problems, post them up.

    Release 4.1.7 · Zomboided/service.vpn.manager · GitHub

    11. API · Zomboided/service.vpn.manager Wiki · GitHub


    Trespasser , I have a couple addons that I have mapped via the skin I use (Mimic) to leap right into the middle of them. I don't know if you can do this with Favourites?

  • Will likely try 4.1.7 zomboided . API might come in handy, I was thinking of something similar so that can see what IP it is connected to.


    Thanks for the update.

  • Trespasser , I have a couple addons that I have mapped via the skin I use (Mimic) to leap right into the middle of them. I don't know if you can do this with Favourites?

    I use Super Favourites (great addon, BTW). I've tried adding a "Favourite" link to "Change or disconnect VPN connection", within VPN Manager, and it worked fine when you clicked on it but when you try backing out it takes you into VPN Manager's selections list and not into my Super Favourites folder.


    A remote key map, like I use to cycle through three NordVPN servers (the "D" key on my remote), would be nice to open the "Change or disconnect VPN connection" section.


    Hope I explained that well enough.


    Later...

  • the_bo install 4.1.7, you'll need to get it from GitHub as it's not on the repo (as it's not interesting for most people) and the API is documented on the wiki. It's vaguely tested, but if you see problems, post them up.

    Release 4.1.7 · Zomboided/service.vpn.manager · GitHub

    11. API · Zomboided/service.vpn.manager Wiki · GitHub


    Trespasser , I have a couple addons that I have mapped via the skin I use (Mimic) to leap right into the middle of them. I don't know if you can do this with Favourites?


    Thanks zomboided for update


    But i cant seem to get it to display anything. I'm not sure if im doing it correctly.


    I tried the following. I put the runscript when skin boots then the info label to display. But so far blank


    ace310 have you had any luck?


    Code
    1. <onload>RunScript(/home/osmc/.kodi/addons/service.vpn.manager/api.py, GetIP)</onload>
    2. <label>$INFO[xbmcgui.Window(10000).getProperty("VPN_Manager_API_State")]</label>


    Thanks for any info

  • Switch on debug trace. You should see in the log that the API is at least being called.


    The API isn't available until VPN manager is running, so doing it before any services are started by Kodi could be an issue.

  • Switch on debug trace. You should see in the log that the API is at least being called.


    The API isn't available until VPN manager is running, so doing it before any services are started by Kodi could be an issue.


    Looking at debug log seems its correctly calling the GETIP api


  • the_bo and zomboided haven't tried it yet, Been busy with work. Most likely that will remain for few more days.


    I have mapped a remote button to connect to a specific connection using api, So when ever I feel or need to see if VPN is connected or not I just tell VPN manager to connect. If it is already connected, the api doesn't do anything. Thus no harm and pretty straight forward.


    Also, I have never done skinning in kodi. So not sure, when I can test this functionality.

  • Here was my test:


    In /home/osmc/.kodi/addons/service.vpn.manager/resources/settings.xml the final (ish) line can be editted to be visible=true and enable=true which basically then puts a button at the bottom of settings/debug which when clicks, drives the API.


    I then added this to the service.py, which basically waited until a property appeared on the window and then printed it out.

    Code
    1. if not xbmcgui.Window(10000).getProperty("VPN_Manager_API_IP") == "":
    2. newPrint(xbmcgui.Window(10000).getProperty("VPN_Manager_API_IP"))


    When I click the debug button to run the API, in the log I see:

    21:52:25.881 T:19512 ERROR: x.x.x.x


    So my conclusion is that the API is working, and the writing to the window is working when the API is called..


    I don't know anything about skinning, or whether we're both looking at the same window (I had been lead to believe that window 10000 was always the home window, and it does look like you're seeing window 10000 from the filtering debug messages), but I do think that the values are being written. I also think you're calling the API and it's doing what it needs to find out the IP.


    Check out the call you're making to read the properties. If you're still getting problems, PM me to debug.

  • No luck getting ip to display. I presume the line is correct. Tried without the xbmcgui also


    $INFO[xbmcgui.Window(10000).getProperty("VPN_Manager_API_IP")]


    The kodi forums are down at the moment to check for sure.


    Will keep testing to see

  • I just tried this from another service (in case the values were somehow related to the service that wrote them), and I can see the values on the home window, no problem. Let's see what the collective knowledge of the kodi forums yield when they come back - or suggest an alternative interface?

  • You won't believe I too started from Nord and using PureVPN now and I hope will never look back.

    Interesting you have no issues with that provider.

    Link #371