diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2018-12-07 14:14:20 +0200 |
---|---|---|
committer | Andrew Newdigate <andrew@gitlab.com> | 2018-12-07 14:14:20 +0200 |
commit | 6322a5e8f7edc612501e1c263590989bf65fc19c (patch) | |
tree | e7d37b963bcfe1fdc037797e5abf1af2b92f39a6 | |
parent | fd67a8df56fb053d072af87b819106a43fc27942 (diff) | |
download | gitlab-shell-6322a5e8f7edc612501e1c263590989bf65fc19c.tar.gz |
Updated DNS resolver
-rw-r--r-- | go/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go | 34 | ||||
-rw-r--r-- | go/vendor/google.golang.org/grpc/resolver/dns/go19.go | 54 | ||||
-rw-r--r-- | go/vendor/google.golang.org/grpc/resolver/dns/pre_go19.go | 51 | ||||
-rw-r--r-- | go/vendor/vendor.json | 10 |
4 files changed, 35 insertions, 114 deletions
diff --git a/go/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/go/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go index 4af6742..f33189f 100644 --- a/go/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ b/go/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -21,6 +21,7 @@ package dns import ( + "context" "encoding/json" "errors" "fmt" @@ -31,7 +32,6 @@ import ( "sync" "time" - "golang.org/x/net/context" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/grpcrand" @@ -43,9 +43,10 @@ func init() { } const ( - defaultPort = "443" - defaultFreq = time.Minute * 30 - golang = "GO" + defaultPort = "443" + defaultFreq = time.Minute * 30 + defaultDNSSvrPort = "53" + golang = "GO" // In DNS, service config is encoded in a TXT record via the mechanism // described in RFC-1464 using the attribute name grpc_config. txtAttribute = "grpc_config=" @@ -61,6 +62,31 @@ var ( errEndsWithColon = errors.New("dns resolver: missing port after port-separator colon") ) +var ( + defaultResolver netResolver = net.DefaultResolver +) + +var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { + return func(ctx context.Context, network, address string) (net.Conn, error) { + var dialer net.Dialer + return dialer.DialContext(ctx, network, authority) + } +} + +var customAuthorityResolver = func(authority string) (netResolver, error) { + host, port, err := parseTarget(authority, defaultDNSSvrPort) + if err != nil { + return nil, err + } + + authorityWithPort := net.JoinHostPort(host, port) + + return &net.Resolver{ + PreferGo: true, + Dial: customAuthorityDialler(authorityWithPort), + }, nil +} + // NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. func NewBuilder() resolver.Builder { return &dnsBuilder{minFreq: defaultFreq} diff --git a/go/vendor/google.golang.org/grpc/resolver/dns/go19.go b/go/vendor/google.golang.org/grpc/resolver/dns/go19.go deleted file mode 100644 index 9886de2..0000000 --- a/go/vendor/google.golang.org/grpc/resolver/dns/go19.go +++ /dev/null @@ -1,54 +0,0 @@ -// +build go1.9 - -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package dns - -import ( - "net" - - "golang.org/x/net/context" -) - -var ( - defaultResolver netResolver = net.DefaultResolver -) - -const defaultDNSSvrPort = "53" - -var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { - return func(ctx context.Context, network, address string) (net.Conn, error) { - var dialer net.Dialer - return dialer.DialContext(ctx, network, authority) - } -} - -var customAuthorityResolver = func(authority string) (netResolver, error) { - host, port, err := parseTarget(authority, defaultDNSSvrPort) - if err != nil { - return nil, err - } - - authorityWithPort := net.JoinHostPort(host, port) - - return &net.Resolver{ - PreferGo: true, - Dial: customAuthorityDialler(authorityWithPort), - }, nil -} diff --git a/go/vendor/google.golang.org/grpc/resolver/dns/pre_go19.go b/go/vendor/google.golang.org/grpc/resolver/dns/pre_go19.go deleted file mode 100644 index 7042811..0000000 --- a/go/vendor/google.golang.org/grpc/resolver/dns/pre_go19.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build go1.6, !go1.9 - -/* - * - * Copyright 2018 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package dns - -import ( - "fmt" - "net" - - "golang.org/x/net/context" -) - -var ( - defaultResolver netResolver = &preGo19Resolver{} -) - -type preGo19Resolver struct { -} - -func (*preGo19Resolver) LookupHost(ctx context.Context, host string) ([]string, error) { - return net.LookupHost(host) -} - -func (*preGo19Resolver) LookupSRV(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return net.LookupSRV(service, proto, name) -} - -func (*preGo19Resolver) LookupTXT(ctx context.Context, name string) ([]string, error) { - return net.LookupTXT(name) -} - -var customAuthorityResolver = func(authority string) (netResolver, error) { - return nil, fmt.Errorf("Default DNS resolver does not support custom DNS server with go < 1.9") -} diff --git a/go/vendor/vendor.json b/go/vendor/vendor.json index 1da82d0..8b025a3 100644 --- a/go/vendor/vendor.json +++ b/go/vendor/vendor.json @@ -379,12 +379,12 @@ "versionExact": "v1.16.0" }, { - "checksumSHA1": "grHAHa6Fi3WBsXJpmlEOlRbWWVg=", + "checksumSHA1": "I9b2MMRa7Sz+hSB0AF/vPFsPOv4=", "path": "google.golang.org/grpc/resolver/dns", - "revision": "2e463a05d100327ca47ac218281906921038fd95", - "revisionTime": "2018-10-23T17:37:47Z", - "version": "v1.16.0", - "versionExact": "v1.16.0" + "revision": "187e357ac194b625331eb5f35c6440c40770f018", + "revisionTime": "2018-12-06T22:02:16Z", + "version": "master", + "versionExact": "master" }, { "checksumSHA1": "zs9M4xE8Lyg4wvuYvR00XoBxmuw=", |