Skip to content

Commit 39a9e4b

Browse files
authored
Support IP Address Argument (#109)
1 parent da7c986 commit 39a9e4b

File tree

5 files changed

+30
-41
lines changed

5 files changed

+30
-41
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,12 @@ Failure
4141

4242
```Bash
4343
> quicreach '*' --stats
44-
SERVER RTT TIME_I TIME_H SEND:RECV C1 S1 FAM VER
45-
quic.aiortc.org 108.957 ms 114.643 ms 232.626 ms 3:5 2480:4899 (2.0x) 276 4546 IPv6 v1 *
46-
ietf.akaquic.com
47-
quic.ogre.com
48-
quic.rocks
49-
mew.org 196.969 ms 198.060 ms 395.859 ms 3:6 2480:6650 (2.7x) 268 4539 IPv6 v2 *
50-
http3-test.litespeedtech.com
51-
msquic.net 85.338 ms 87.281 ms 93.002 ms 1:4 1260:3660 (2.9x) 271 3460 IPv4 v1
52-
nghttp2.org
53-
cloudflare-quic.com 12.880 ms 15.742 ms 22.834 ms 1:7 1240:5128 (4.1x) 280 2666 IPv6 v1 !
54-
pandora.cm.in.tum.de
44+
SERVER RTT TIME_I TIME_H SEND:RECV C1 S1 VER IP
45+
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 *
46+
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 !
47+
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 *
48+
twitter.com
49+
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 !
5550
```
5651

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

7471
# Contributing

src/domains.hpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,6 @@
77

88
const char* TopDomains[] =
99
{
10-
// Known interop servers
11-
"quic.aiortc.org",
12-
"ietf.akaquic.com",
13-
"quic.ogre.com",
14-
"quic.rocks",
15-
"mew.org",
16-
"http3-test.litespeedtech.com",
17-
"msquic.net",
18-
"nghttp2.org",
19-
"cloudflare-quic.com",
20-
"pandora.cm.in.tum.de",
21-
"test.privateoctopus.com",
22-
"quant.eggert.org",
23-
"h3.stammw.eu",
24-
"quic.seemann.io",
25-
"quic.tech",
26-
"quicker.edm.uhasselt.be",
27-
"quic.examp1e.net",
28-
"h2o.examp1e.net",
29-
"www.haproxy.org",
30-
"outlook-evergreen.office.com",
31-
"outlook.office.com",
3210
// Top-level domains - found on https://majestic.com/reports/majestic-million?s=0
3311
// data are processed such that root domains appear only once
3412
"google.com",
@@ -100,6 +78,7 @@ const char* TopDomains[] =
10078
"youtube-nocookie.com",
10179
"oracle.com",
10280
"office.com",
81+
"outlook.office.com", // Extra variant known to support HTTP/3
10382
"bloomberg.com",
10483
"harvard.edu",
10584
"imdb.com",

src/installer.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Manufacturer="Microsoft"
66
Name="quicreach"
77
UpgradeCode="8395c163-ac9f-4a89-82fc-689fe25f0777"
8-
Version="1.2.0.0">
8+
Version="1.3.0.0">
99
<Package InstallScope="perUser" Compressed="yes" />
1010
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
1111
<MediaTemplate EmbedCab="yes" />

src/quicreach.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct ReachConfig {
3939
bool PrintStatistics {false};
4040
bool RequireAll {false};
4141
std::vector<const char*> HostNames;
42+
QuicAddr Address;
4243
uint32_t Parallel {1};
4344
uint16_t Port {443};
4445
MsQuicAlpn Alpn {"h3"};
@@ -124,6 +125,7 @@ bool ParseConfig(int argc, char **argv) {
124125
" -b, --built-in-val Use built-in TLS validation logic\n"
125126
" -c, --csv <file> Writes CSV results to the given file\n"
126127
" -h, --help Prints this help text\n"
128+
" -i, --ip <address> The IP address to use\n"
127129
" -l, --parallel <num> The numer of parallel hosts to test at once (def=1)\n"
128130
" -m, --mtu <mtu> The initial (IPv6) MTU to use (def=1288)\n"
129131
" -p, --port <port> The UDP port to use (def=443)\n"
@@ -154,14 +156,20 @@ bool ParseConfig(int argc, char **argv) {
154156
if (++i >= argc) { printf("Missing MTU value\n"); return false; }
155157
Config.Settings.SetMinimumMtu((uint16_t)atoi(argv[i]));
156158

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

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

169+
} else if (!strcmp(argv[i], "--port") || !strcmp(argv[i], "-p")) {
170+
if (++i >= argc) { printf("Missing port number\n"); return false; }
171+
Config.Port = (uint16_t)atoi(argv[i]);
172+
165173
} else if (!strcmp(argv[i], "--stats") || !strcmp(argv[i], "-s")) {
166174
Config.PrintStatistics = true;
167175

@@ -190,6 +198,9 @@ struct ReachConnection : public MsQuicConnection {
190198
) : MsQuicConnection(Registration, CleanUpAutoDelete, Callback), HostName(HostName) {
191199
IncStat(Results.TotalCount);
192200
Results.IncActive();
201+
if (IsValid() && Config.Address.GetFamily() != QUIC_ADDRESS_FAMILY_UNSPEC) {
202+
InitStatus = SetRemoteAddr(Config.Address);
203+
}
193204
if (IsValid()) {
194205
InitStatus = Start(Configuration, HostName, Config.Port);
195206
}
@@ -249,8 +260,10 @@ struct ReachConnection : public MsQuicConnection {
249260
TooMuch ? '!' : (MultiRtt ? '*' : ' '),
250261
Retry ? 'R' : ' ',
251262
'\0'};
263+
QUIC_ADDR_STR AddrStr;
264+
QuicAddrToString(&RemoteAddr.SockAddr, &AddrStr);
252265
unique_lock<mutex> lock(Results.Mutex);
253-
printf("%30s %3u.%03u ms %3u.%03u ms %3u.%03u ms %u:%u %u:%u (%2.1fx) %4u %4u %s %s %s\n",
266+
printf("%30s %3u.%03u ms %3u.%03u ms %3u.%03u ms %u:%u %u:%u (%2.1fx) %4u %4u %s %20s %s\n",
254267
HostName,
255268
Stats.Rtt / 1000, Stats.Rtt % 1000,
256269
InitialTime / 1000, InitialTime % 1000,
@@ -262,8 +275,8 @@ struct ReachConnection : public MsQuicConnection {
262275
Amplification,
263276
Stats.HandshakeClientFlight1Bytes,
264277
Stats.HandshakeServerFlight1Bytes,
265-
RemoteAddr.GetFamily() == QUIC_ADDRESS_FAMILY_INET6 ? "IPv6" : "IPv4",
266278
Version == QUIC_VERSION_1 ? "v1" : "v2",
279+
AddrStr.Address,
267280
HandshakeTags);
268281
}
269282
}
@@ -308,7 +321,7 @@ bool TestReachability() {
308321
Configuration.SetVersionNegotiationExtEnabled();
309322

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

313326
for (auto HostName : Config.HostNames) {
314327
new ReachConnection(Registration, Configuration, HostName);

src/quicreach.ver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#endif
99

1010
#ifndef VER_MINOR
11-
#define VER_MINOR 2
11+
#define VER_MINOR 3
1212
#endif
1313

1414
#ifndef VER_PATCH

0 commit comments

Comments
 (0)