1
0
mirror of https://github.com/golang/go synced 2024-11-06 06:26:13 -07:00
go/src/net/lookup_fake.go

59 lines
1.6 KiB
Go
Raw Normal View History

// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build js,wasm
package net
import (
"context"
"syscall"
)
net: fix plan9 after context change, propagate contexts more My previous https://golang.org/cl/22101 to add context throughout the net package broke Plan 9, which isn't currently tested (#15251). It also broke some old unsupported version of Windows (Windows 2000?) which doesn't have the ConnectEx function, but that was only found visually, since our minimum supported Windows version has ConnectEx. This change simplifies the Windows and deletes the non-ConnectEx code path. Windows 2000 will work even less now, if it even worked before. Windows XP remains our minimum supported version. Specifically, the previous CL stopped using the "dial" function, which 0intro noted: https://github.com/golang/go/issues/15333#issuecomment-210842761 This CL removes the dial function instead and makes plan9's net implementation respect contexts, which likely fixes a number of t.Skipped tests. I'm leaving that to 0intro to investigate. In the process of propagating and respecting contexts for plan9, I had to change some signatures to add contexts to more places and ended up pushing contexts down into the Go-based DNS resolution as well, replacing the pure-Go DNS implementation's use of "timeout time.Duration" with a context instead. Updates #11932 Updates #15328 Fixes #15333 Change-Id: I6ad1e62f38271cdd86b3f40921f2d0f23374936a Reviewed-on: https://go-review.googlesource.com/22144 Reviewed-by: David du Colombier <0intro@gmail.com> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-16 15:17:40 -06:00
func lookupProtocol(ctx context.Context, name string) (proto int, err error) {
return lookupProtocolMap(name)
}
func (*Resolver) lookupHost(ctx context.Context, host string) (addrs []string, err error) {
return nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupIP(ctx context.Context, network, host string) (addrs []IPAddr, err error) {
return nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupPort(ctx context.Context, network, service string) (port int, err error) {
return goLookupPort(network, service)
}
func (*Resolver) lookupCNAME(ctx context.Context, name string) (cname string, err error) {
return "", syscall.ENOPROTOOPT
}
func (*Resolver) lookupSRV(ctx context.Context, service, proto, name string) (cname string, srvs []*SRV, err error) {
return "", nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupMX(ctx context.Context, name string) (mxs []*MX, err error) {
return nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupNS(ctx context.Context, name string) (nss []*NS, err error) {
return nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupTXT(ctx context.Context, name string) (txts []string, err error) {
return nil, syscall.ENOPROTOOPT
}
func (*Resolver) lookupAddr(ctx context.Context, addr string) (ptrs []string, err error) {
return nil, syscall.ENOPROTOOPT
}
// concurrentThreadsLimit returns the number of threads we permit to
// run concurrently doing DNS lookups.
func concurrentThreadsLimit() int {
return 500
}