Skip to content

Commit

Permalink
Support IP Address Argument (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Mar 22, 2023
1 parent da7c986 commit 39a9e4b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 41 deletions.
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@ Failure

```Bash
> quicreach '*' --stats
SERVER RTT TIME_I TIME_H SEND:RECV C1 S1 FAM VER
quic.aiortc.org 108.957 ms 114.643 ms 232.626 ms 3:5 2480:4899 (2.0x) 276 4546 IPv6 v1 *
ietf.akaquic.com
quic.ogre.com
quic.rocks
mew.org 196.969 ms 198.060 ms 395.859 ms 3:6 2480:6650 (2.7x) 268 4539 IPv6 v2 *
http3-test.litespeedtech.com
msquic.net 85.338 ms 87.281 ms 93.002 ms 1:4 1260:3660 (2.9x) 271 3460 IPv4 v1
nghttp2.org
cloudflare-quic.com 12.880 ms 15.742 ms 22.834 ms 1:7 1240:5128 (4.1x) 280 2666 IPv6 v1 !
pandora.cm.in.tum.de
SERVER RTT TIME_I TIME_H SEND:RECV C1 S1 VER IP
google.com 2.409 ms 2.936 ms 5.461 ms 3:7 2520:8370 (3.3x) 287 6901 v1 172.253.62.102:443 *
facebook.com 1.845 ms 4.250 ms 4.722 ms 1:4 1260:4512 (3.6x) 289 3245 v1 31.13.66.35:443 !
youtube.com 2.702 ms 3.020 ms 6.491 ms 3:7 2520:8361 (3.3x) 288 6893 v1 142.251.163.93:443 *
twitter.com
instagram.com 0.944 ms 3.259 ms 3.717 ms 1:4 1260:4464 (3.5x) 290 3197 v1 31.13.66.174:443 !
```

### Full Help
Expand All @@ -63,12 +58,14 @@ usage: quicreach <hostname(s)> [options...]
-b, --built-in-val Use built-in TLS validation logic
-c, --csv <file> Writes CSV results to the given file
-h, --help Prints this help text
-i, --ip <address> The IP address to use
-l, --parallel <num> The numer of parallel hosts to test at once (def=1)
-m, --mtu <mtu> The initial (IPv6) MTU to use (def=1288)
-p, --port <port> The UDP port to use (def=443)
-r, --req-all Require all hostnames to succeed
-s, --stats Print connection statistics
-u, --unsecure Allows unsecure connections
-v, --version Prints out the version
```

# Contributing
Expand Down
23 changes: 1 addition & 22 deletions src/domains.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,6 @@

const char* TopDomains[] =
{
// Known interop servers
"quic.aiortc.org",
"ietf.akaquic.com",
"quic.ogre.com",
"quic.rocks",
"mew.org",
"http3-test.litespeedtech.com",
"msquic.net",
"nghttp2.org",
"cloudflare-quic.com",
"pandora.cm.in.tum.de",
"test.privateoctopus.com",
"quant.eggert.org",
"h3.stammw.eu",
"quic.seemann.io",
"quic.tech",
"quicker.edm.uhasselt.be",
"quic.examp1e.net",
"h2o.examp1e.net",
"www.haproxy.org",
"outlook-evergreen.office.com",
"outlook.office.com",
// Top-level domains - found on https://majestic.com/reports/majestic-million?s=0
// data are processed such that root domains appear only once
"google.com",
Expand Down Expand Up @@ -100,6 +78,7 @@ const char* TopDomains[] =
"youtube-nocookie.com",
"oracle.com",
"office.com",
"outlook.office.com", // Extra variant known to support HTTP/3
"bloomberg.com",
"harvard.edu",
"imdb.com",
Expand Down
2 changes: 1 addition & 1 deletion src/installer.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Manufacturer="Microsoft"
Name="quicreach"
UpgradeCode="8395c163-ac9f-4a89-82fc-689fe25f0777"
Version="1.2.0.0">
Version="1.3.0.0">
<Package InstallScope="perUser" Compressed="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<MediaTemplate EmbedCab="yes" />
Expand Down
25 changes: 19 additions & 6 deletions src/quicreach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct ReachConfig {
bool PrintStatistics {false};
bool RequireAll {false};
std::vector<const char*> HostNames;
QuicAddr Address;
uint32_t Parallel {1};
uint16_t Port {443};
MsQuicAlpn Alpn {"h3"};
Expand Down Expand Up @@ -124,6 +125,7 @@ bool ParseConfig(int argc, char **argv) {
" -b, --built-in-val Use built-in TLS validation logic\n"
" -c, --csv <file> Writes CSV results to the given file\n"
" -h, --help Prints this help text\n"
" -i, --ip <address> The IP address to use\n"
" -l, --parallel <num> The numer of parallel hosts to test at once (def=1)\n"
" -m, --mtu <mtu> The initial (IPv6) MTU to use (def=1288)\n"
" -p, --port <port> The UDP port to use (def=443)\n"
Expand Down Expand Up @@ -154,14 +156,20 @@ bool ParseConfig(int argc, char **argv) {
if (++i >= argc) { printf("Missing MTU value\n"); return false; }
Config.Settings.SetMinimumMtu((uint16_t)atoi(argv[i]));

} else if (!strcmp(argv[i], "--port") || !strcmp(argv[i], "-p")) {
if (++i >= argc) { printf("Missing port number\n"); return false; }
Config.Port = (uint16_t)atoi(argv[i]);
} else if (!strcmp(argv[i], "--ip") || !strcmp(argv[i], "-i")) {
if (++i >= argc) { printf("Missing IP address\n"); return false; }
if (!QuicAddrFromString(argv[i], 0, &Config.Address.SockAddr)) {
printf("Invalid address arg passed in\n"); return false;
}

} else if (!strcmp(argv[i], "--parallel") || !strcmp(argv[i], "-l")) {
if (++i >= argc) { printf("Missing parallel number\n"); return false; }
Config.Parallel = (uint32_t)atoi(argv[i]);

} else if (!strcmp(argv[i], "--port") || !strcmp(argv[i], "-p")) {
if (++i >= argc) { printf("Missing port number\n"); return false; }
Config.Port = (uint16_t)atoi(argv[i]);

} else if (!strcmp(argv[i], "--stats") || !strcmp(argv[i], "-s")) {
Config.PrintStatistics = true;

Expand Down Expand Up @@ -190,6 +198,9 @@ struct ReachConnection : public MsQuicConnection {
) : MsQuicConnection(Registration, CleanUpAutoDelete, Callback), HostName(HostName) {
IncStat(Results.TotalCount);
Results.IncActive();
if (IsValid() && Config.Address.GetFamily() != QUIC_ADDRESS_FAMILY_UNSPEC) {
InitStatus = SetRemoteAddr(Config.Address);
}
if (IsValid()) {
InitStatus = Start(Configuration, HostName, Config.Port);
}
Expand Down Expand Up @@ -249,8 +260,10 @@ struct ReachConnection : public MsQuicConnection {
TooMuch ? '!' : (MultiRtt ? '*' : ' '),
Retry ? 'R' : ' ',
'\0'};
QUIC_ADDR_STR AddrStr;
QuicAddrToString(&RemoteAddr.SockAddr, &AddrStr);
unique_lock<mutex> lock(Results.Mutex);
printf("%30s %3u.%03u ms %3u.%03u ms %3u.%03u ms %u:%u %u:%u (%2.1fx) %4u %4u %s %s %s\n",
printf("%30s %3u.%03u ms %3u.%03u ms %3u.%03u ms %u:%u %u:%u (%2.1fx) %4u %4u %s %20s %s\n",
HostName,
Stats.Rtt / 1000, Stats.Rtt % 1000,
InitialTime / 1000, InitialTime % 1000,
Expand All @@ -262,8 +275,8 @@ struct ReachConnection : public MsQuicConnection {
Amplification,
Stats.HandshakeClientFlight1Bytes,
Stats.HandshakeServerFlight1Bytes,
RemoteAddr.GetFamily() == QUIC_ADDRESS_FAMILY_INET6 ? "IPv6" : "IPv4",
Version == QUIC_VERSION_1 ? "v1" : "v2",
AddrStr.Address,
HandshakeTags);
}
}
Expand Down Expand Up @@ -308,7 +321,7 @@ bool TestReachability() {
Configuration.SetVersionNegotiationExtEnabled();

if (Config.PrintStatistics)
printf("%30s RTT TIME_I TIME_H SEND:RECV C1 S1 FAM VER\n", "SERVER");
printf("%30s RTT TIME_I TIME_H SEND:RECV C1 S1 VER IP\n", "SERVER");

for (auto HostName : Config.HostNames) {
new ReachConnection(Registration, Configuration, HostName);
Expand Down
2 changes: 1 addition & 1 deletion src/quicreach.ver
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#endif

#ifndef VER_MINOR
#define VER_MINOR 2
#define VER_MINOR 3
#endif

#ifndef VER_PATCH
Expand Down

0 comments on commit 39a9e4b

Please sign in to comment.