Awesome
Wehe Command Line Client
This is the Wehe command line client. This app runs tests to help users determine whether their ISPs are throttling network traffic for certain apps or ports. Please see https://wehe.meddle.mobi/ for more details.
There are two ways to run the code:
- Run the jar file (
wehe-cmdline.jar
) - Build from source (use Java 17)
About the Code
- The code is based off of the Wehe Android Client.
- Building the source code requires two additional libraries: Tyrus Standalone Client v1.17 for WebSocket support and JSON (Maven repo).
- The
src/
directory contains the source files. - The
res/
directory contains the app and port client traffic for the tests. - The code runs one test (one app/port replay and one "random" replay) for each shell command.
Build jar with Maven
This source code contains pom.xml
file with the configuration and dependencies needed to build the jar file.
To build the jar file, simply execute: mvn package
.
Run the jar
A compiled jar comes with the repo (wehe-cmdline.jar
). This jar was compiled using Java 17. To
run this jar, it must be in the same directory as the res/
directory.
Certificates
If using this client with different certificates than the production certificates, replace
res/main
with the proper PEM certificate.
Usage
Usage: java -jar wehe-cmdline.jar -n <TEST_NAME> [OPTION]...
Example: java -jar wehe-cmdline.jar -n applemusic -c -r results/ -l info
Options
-n TEST_NAME
- The name of the test to run. Argument required. See below for list of test names.
-s SERV_NAME
- The hostname or IP of server to run the tests. Default: wehe4.meddle.mobi
.
-m MLAB_API
- The URL of the API to retrieve access envelopes to run tests on M-Lab servers.
Default: https://locate.measurementlab.net/v2/nearest/wehe/replay
.
-u MUM_SRVR
- The number of servers to run the test concurrently. This feature is available only
with M-Lab servers. Must be integer between 1 and 4 inclusive. Default: 1
.
-c
- Turn off confirmation replays (if test is inconclusive, it will automatically rerun by default).
-a A_THRESH
- The area threshold percentage for determining differentiation. Default: 50
.
-k KS2P_VAL
- The KS2P-value threshold percentage for determining differentiation. Default: 1
.
-t RESR_ROOT
- The resources root containing apps_list.json
and the tests. No need to change
this if using the jar or if you don't move the res/
directory. Default: res/
.
-r RSLT_ROOT
- The results root containing the output logs and info. Default: test_results/
.
-l LOG_LEVEL
- The level of logs and above that should be printed to console (all levels will be
saved to logs on disk regardless of the level printed to console). Choose from wtf
, error
,
warn
, info
, or debug
. Default: none of these, only UI
logs (what the user would see on screen
when running the Android app) will be printed to the console.
-h
- Print the help message.
-v
- Print the version number.
Tests
App Name | Test Name (-n arg) | Port Name | Test Name (-n arg) |
---|---|---|---|
Amazon Prime Video | amazon | 80 HTTP small | port80s |
Apple Music | applemusic | 81 HTTP small | port81s |
Dailymotion | dailymotion | 465 SMTPS small | port465s |
Deezer | deezer | 853 DoT small | port853s |
Discord | discord | 993 IMAPS small | port993s |
Disney+ | disneyplus | 995 POP3S small | port995s |
ESPN | espn | 1194 OpenVPN small | port1194s |
facebook | 1701 L2TP small | port1701s | |
Google Meet | meet | 5061 SIPS small | port5061s |
Hulu | hulu | 6881 BitTorrent small | port6881s |
instagram | 8080 SpeedTest small | port8080s | |
Max | max | 8443 SpeedTest small | port8443s |
Microsoft Teams | teams | 80 HTTPS large | port80l |
NBC Sports | nbcsports | 81 HTTP large | port81l |
Netflix | netflix | 465 SMTPS large | port465l |
Molotov TV | molotovtv | 853 DoT large | port853l |
myCANAL | mycanal | 993 IMAPS large | port993l |
OCS | ocs | 995 POP3S large | port995l |
Pandora | pandora | 1194 OpenVPN large | port1194l |
Salto | salto | 1701 L2TP large | port1701l |
SFR Play | sfrplay | 5061 SIPS large | port5061l |
Skype | skype | 6881 BitTorrent large | port6881l |
Snapchat | snapchat | 8080 SpeedTest large | port8080l |
Spotify | spotify | 8443 SpeedTest large | port8443l |
TikTok | tiktok | ||
Twitch | twitch | ||
Vimeo | vimeo | ||
Webex | webex | ||
whatsapp | |||
X | x | ||
YouTube | youtube | ||
Zoom | zoom |
Note: Small port tests are 10 MB per replay, while large port tests are 50 MB per replay.
Output
Output is contained in RSLT_ROOT
:
- By default, the name of
RSLT_ROOT
isres/
(change the directory name using the-r
option). info.txt
- This file contains the user's random ID and the current history count.logs/
- This directory contains the logs that would be printed to the Android logs (think of Android's Log class).- Log files are the in the format
logs_<randomID>_<historyCount>_<exitCode>.txt
.
- Log files are the in the format
ui/
- This directory contains the text that a user running the Android client would see on his/her screen.- Log files are in the format
ui_<randomID>_<historyCount>_<exitCode>.txt
.
- Log files are in the format
Exit Codes
Each error exit code corresponds to a specific spot in the code where execution of the tests was terminated. CTRL+F the exit status on the code base to find where each of these locations are located.
Exit Code | Exit Status | Explanation |
---|---|---|
0 | SUCCESS | No errors occurred during the test. |
1 | ERR_GENERAL | An error occurred that does not fit any below. |
2 | ERR_CMDLINE | Invalid command line input. |
3 | ERR_INFO_RD | Error reading from info.txt . |
4 | ERR_INFO_WR | Error writing to info.txt . |
5 | ERR_WR_LOGS | Error writing to the logs. |
6 | ERR_CONN_IP | Error connecting to server because IP not found. |
7 | ERR_CONN_INST | Error getting instance of TCP or UDP socket to send data. |
8 | ERR_CONN_IO_SERV | IO issue with the SideChannel. |
9 | ERR_CONN_WS | Error connecting to WebSocket. |
10 | ERR_UNK_HOST | Error connecting to the server. |
11 | ERR_UNK_META_HOST | Error connecting to metadata server. |
12 | ERR_CERT | Error with the certificates. |
13 | ERR_NO_ID | No random ID found. |
14 | ERR_NO_TEST | Test not found on client. |
15 | ERR_PERM_REPLAY | Test not found on server. |
16 | ERR_PERM_IP | Another user with the same IP is running tests on the server. |
17 | ERR_PERM_RES | Server is low on resources. |
18 | ERR_PERM_UNK | Unknown server error. |
19 | ERR_ANA_NULL | No analysis status returned. |
20 | ERR_ANA_NO_SUC | Analysis did not succeed. |
21 | ERR_ANA_HIST_CT | Invalid analysis history count. |
22 | ERR_RSLT_NULL | No result status returned. |
23 | ERR_RSLT_NO_RESP | Result succeed, but result was not sent. |
24 | ERR_RSLT_NO_SUC | Result not found. |
25 | ERR_RSLT_ID_HC | Result returned wrong random ID or history count. |
26 | ERR_BAD_JSON | JSON error. |
NOTE: If the Exit Code is negative, then two errors occurred: the number in the Exit Code and
ERR_WR_LOGS
. For example, -24
means no result was found and the logs could not be written to disk.