control/controlclient: make js/wasm work with Go 1.18+
Updates #3157 Change-Id: I2d67e582842ab3638d720bb5db4701b878ad4473 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>pull/3278/head
parent
87137405e5
commit
ad63fc0510
|
@ -146,6 +146,13 @@ func NewDirect(opts Options) (*Direct, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
httpc := opts.HTTPTestClient
|
httpc := opts.HTTPTestClient
|
||||||
|
if httpc == nil && runtime.GOOS == "js" {
|
||||||
|
// In js/wasm, net/http.Transport (as of Go 1.18) will
|
||||||
|
// only use the browser's Fetch API if you're using
|
||||||
|
// the DefaultClient (or a client without dial hooks
|
||||||
|
// etc set).
|
||||||
|
httpc = http.DefaultClient
|
||||||
|
}
|
||||||
if httpc == nil {
|
if httpc == nil {
|
||||||
dnsCache := &dnscache.Resolver{
|
dnsCache := &dnscache.Resolver{
|
||||||
Forward: dnscache.Get().Forward, // use default cache's forwarder
|
Forward: dnscache.Get().Forward, // use default cache's forwarder
|
||||||
|
|
Loading…
Reference in New Issue