skywire icon indicating copy to clipboard operation
skywire copied to clipboard

Make it possible to get the data stats from Skywiremob

Open Senyoret1 opened this issue 5 years ago • 7 comments

Feature description If Skywiremob currently has stats about data transmission (how many data has been sent/received and the data transmission speed), it would be good to add one or more functions to it for being able to get that data from the Android app. If the data is not already available in Skywiremob, the Android app would be able to calculate it in an intermediary step.

CC: @Darkren

Senyoret1 avatar Oct 03 '20 18:10 Senyoret1

@Senyoret1 you're just in time, we've recently added this functionality. I'll expose methods

Darkren avatar Oct 05 '20 06:10 Darkren

@Senyoret1 I added methods:

  • VPNBandwidthSent: Returns amount of bandwidth sent over VPN (bytes);
  • VPNBandwidthReceived: Returns amount of bandwidth received over VPN (bytes);
  • VPNLatency: Returns latency (ms);
  • VPNThroughput: Returns throughput (bytes/s).

Please try it out. They work only when VPN is running. Otherwise 0 will be returned

Darkren avatar Oct 15 '20 08:10 Darkren

I modified the Android client to use the data and had some problems. At least in my tests, this is what I think I’m getting:

  • vpnBandwidthReceived: the current download speed.
  • vpnBandwidthSent: the total amount of uploaded data.
  • vpnThroughput and vpnLatency: always zero.

I made the changes in the Android app anyway, assuming the values are correct, but that means the app is showing incorrect values.

Apart from that, looking at the listed values, I’m not sure if there is way to get the uploading and downloading speed individually, which may be needed for the app, at least for the current plans for the UI. In fact, it would be good to have the latency, downloading speed, uploading speed, total downloaded data and total uploaded data. Sorry for not being totally clear on that from the beginning.

Senyoret1 avatar Oct 15 '20 22:10 Senyoret1

@Senyoret1 hm, when I tested these funcs with the usual visor it worked well. I'll check

Darkren avatar Oct 16 '20 07:10 Darkren

@Senyoret1 ah, gosh, sorry, forgot to mention one thing. These funcs were added to the feature/v0.4.0 branch only, and they require both visors to be built from that branch, remote and mobile. Please, try building the remote visor from feature/v0.4.0. Visors exchange additional packets to calculate stats, old visors just don't recognize this type of packet

Darkren avatar Oct 16 '20 07:10 Darkren

I checked with the 0.4.0 version and more info was returned by Skywiremob. However, it appears that there are still some problems:

  • Maybe there is an error with the latency. I’m testing running the app in the Android emulator and the visor with the VPN server in a virtual machine in the same computer, so the connection should be very fast, and the latency is always 4294, even after several tries. When I use the web browser in the emulator, the response takes a much less than 4 seconds, so the number does not appear to be correct. Also, that value is the max value of an unsigned int divided by 1,000,000, so it appears that the value is just an unsigned int var which reached its max value and then was converted from nanoseconds to microseconds.

  • The data values still appear to have some problems. The values of vpnBandwidthReceived and vpnThroughput go up and down independently while navigating with the web browser, which makes me think that vpnBandwidthReceived returns the current download speed and vpnThroughput the current upload speed, which are 2 data values I’m interested in being able to get but don’t have the correct function names. On the other hand, the value of vpnBandwidthSent goes up while navigating and never goes down, so I think it is returning how many data has been received since the VPN connection was started (which is the expected behavior), but there is no way to know how many data has been downloaded.

Senyoret1 avatar Oct 16 '20 18:10 Senyoret1

I checked using the last version of the develop branch in the server and I think the problems in the last comment are still valid, unless I’m testing something wrong. Currently, the builds I’m creating of the Android client show wrong data.

Senyoret1 avatar Feb 26 '21 22:02 Senyoret1