blob: 70428113b84c43281f2b9f444504e78f7fa71088 [file] [log] [blame]
Serge Bazanskicc25bdf2018-10-25 14:02:58 +02001// +build go1.6, !go1.9
2
3/*
4 *
5 * Copyright 2018 gRPC authors.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21package dns
22
23import (
24 "fmt"
25 "net"
26
27 "golang.org/x/net/context"
28)
29
30var (
31 defaultResolver netResolver = &preGo19Resolver{}
32)
33
34type preGo19Resolver struct {
35}
36
37func (*preGo19Resolver) LookupHost(ctx context.Context, host string) ([]string, error) {
38 return net.LookupHost(host)
39}
40
41func (*preGo19Resolver) LookupSRV(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) {
42 return net.LookupSRV(service, proto, name)
43}
44
45func (*preGo19Resolver) LookupTXT(ctx context.Context, name string) ([]string, error) {
46 return net.LookupTXT(name)
47}
48
49var customAuthorityResolver = func(authority string) (netResolver, error) {
50 return nil, fmt.Errorf("Default DNS resolver does not support custom DNS server with go < 1.9")
51}