-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[forwardport] fix: avoid http3 for dns.google and www.google.com (#593)…
… (#594) This commit forward ports dedd84f. Original commit message: - - - This diff changes code the release/3.11 branch to ensure we're not using dns.google and www.google.com over HTTP3. As documented in ooni/probe#1873, since this morning (approx) these services do not support HTTP3 anymore. (I didn't bother with checking whether this issue affects _other_ Google services; I just limited my analysis to the services that we were using as part of testing.) This patch WILL require forward porting to the master branch.
- Loading branch information
1 parent
3dad324
commit 0a322eb
Showing
9 changed files
with
90 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package quictesting contains code useful to test QUIC. | ||
package quictesting | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"strings" | ||
"time" | ||
|
||
"github.com/ooni/probe-cli/v3/internal/runtimex" | ||
) | ||
|
||
// Domain is the the domain we should be testing using QUIC. | ||
const Domain = "www.cloudflare.com" | ||
|
||
// Address is the address we should be testing using QUIC. | ||
var Address string | ||
|
||
// Endpoint returns the endpoint to test using QUIC by combining | ||
// the Address variable with the given port. | ||
func Endpoint(port string) string { | ||
return net.JoinHostPort(Address, port) | ||
} | ||
|
||
func init() { | ||
const timeout = 10 * time.Second | ||
ctx, cancel := context.WithTimeout(context.Background(), timeout) | ||
defer cancel() | ||
reso := &net.Resolver{} | ||
addrs, err := reso.LookupHost(ctx, Domain) | ||
runtimex.PanicOnError(err, "reso.LookupHost failed") | ||
for _, addr := range addrs { | ||
if !strings.Contains(addr, ":") { | ||
Address = addr | ||
break | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package quictesting | ||
|
||
import ( | ||
"net" | ||
"testing" | ||
) | ||
|
||
func TestWorksAsIntended(t *testing.T) { | ||
epnt := Endpoint("443") | ||
addr, port, err := net.SplitHostPort(epnt) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if addr != Address { | ||
t.Fatal("invalid addr") | ||
} | ||
if port != "443" { | ||
t.Fatal("invalid port") | ||
} | ||
} |