mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	Fix some typos in comments. (#4100)
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
This commit is contained in:
		| @@ -52,7 +52,7 @@ type Config struct { | ||||
| 	registry map[string]plugin.Handler | ||||
| } | ||||
|  | ||||
| // keyForConfig build a key for identifying the configs during setup time | ||||
| // keyForConfig builds a key for identifying the configs during setup time | ||||
| func keyForConfig(blocIndex int, blocKeyIndex int) string { | ||||
| 	return fmt.Sprintf("%d:%d", blocIndex, blocKeyIndex) | ||||
| } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package dnsserver | ||||
|  | ||||
| import "fmt" | ||||
|  | ||||
| // startUpZones create the text that we show when starting up: | ||||
| // startUpZones creates the text that we show when starting up: | ||||
| // grpc://example.com.:1055 | ||||
| // example.com.:1053 on 127.0.0.1 | ||||
| func startUpZones(protocol, addr string, zones map[string]*Config) string { | ||||
|   | ||||
| @@ -194,7 +194,7 @@ func (s *Server) Stop() (err error) { | ||||
| // Address together with Stop() implement caddy.GracefulServer. | ||||
| func (s *Server) Address() string { return s.Addr } | ||||
|  | ||||
| // ServeDNS is the entry point for every request to the address that s | ||||
| // ServeDNS is the entry point for every request to the address that  | ||||
| // is bound to. It acts as a multiplexer for the requests zonename as | ||||
| // defined in the request so that the correct zone | ||||
| // (configuration and plugin stack) will handle the request. | ||||
|   | ||||
| @@ -34,7 +34,7 @@ func NewServergRPC(addr string, group []*Config) (*ServergRPC, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	// The *tls* plugin must make sure that multiple conflicting | ||||
| 	// TLS configuration return an error: it can only be specified once. | ||||
| 	// TLS configuration returns an error: it can only be specified once. | ||||
| 	var tlsConfig *tls.Config | ||||
| 	for _, conf := range s.zones { | ||||
| 		// Should we error if some configs *don't* have TLS? | ||||
|   | ||||
| @@ -33,7 +33,7 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	// The *tls* plugin must make sure that multiple conflicting | ||||
| 	// TLS configuration return an error: it can only be specified once. | ||||
| 	// TLS configuration returns an error: it can only be specified once. | ||||
| 	var tlsConfig *tls.Config | ||||
| 	for _, conf := range s.zones { | ||||
| 		// Should we error if some configs *don't* have TLS? | ||||
|   | ||||
| @@ -26,7 +26,7 @@ func NewServerTLS(addr string, group []*Config) (*ServerTLS, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	// The *tls* plugin must make sure that multiple conflicting | ||||
| 	// TLS configuration return an error: it can only be specified once. | ||||
| 	// TLS configuration returns an error: it can only be specified once. | ||||
| 	var tlsConfig *tls.Config | ||||
| 	for _, conf := range s.zones { | ||||
| 		// Should we error if some configs *don't* have TLS? | ||||
|   | ||||
| @@ -54,7 +54,7 @@ type AutoPather interface { | ||||
| 	AutoPath(request.Request) []string | ||||
| } | ||||
|  | ||||
| // AutoPath perform autopath: service side search path completion. | ||||
| // AutoPath performs autopath: service side search path completion. | ||||
| type AutoPath struct { | ||||
| 	Next  plugin.Handler | ||||
| 	Zones []string | ||||
|   | ||||
| @@ -26,7 +26,7 @@ type ServiceBackend interface { | ||||
| 	// Note: it does not implement a specific service. | ||||
| 	Records(ctx context.Context, state request.Request, exact bool) ([]msg.Service, error) | ||||
|  | ||||
| 	// IsNameError return true if err indicated a record not found condition | ||||
| 	// IsNameError returns true if err indicated a record not found condition | ||||
| 	IsNameError(err error) bool | ||||
|  | ||||
| 	Transferer | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import ( | ||||
| 	"github.com/miekg/dns" | ||||
| ) | ||||
|  | ||||
| // hash serializes the RRset and return a signature cache key. | ||||
| // hash serializes the RRset and returns a signature cache key. | ||||
| func hash(rrs []dns.RR) uint64 { | ||||
| 	h := fnv.New64() | ||||
| 	buf := make([]byte, 256) | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import ( | ||||
| 	"github.com/miekg/dns" | ||||
| ) | ||||
|  | ||||
| // ResponseWriter sign the response on the fly. | ||||
| // ResponseWriter signs the response on the fly. | ||||
| type ResponseWriter struct { | ||||
| 	dns.ResponseWriter | ||||
| 	d      Dnssec | ||||
|   | ||||
| @@ -2,7 +2,7 @@ package dnssec | ||||
|  | ||||
| import "github.com/miekg/dns" | ||||
|  | ||||
| // newRRSIG return a new RRSIG, with all fields filled out, except the signed data. | ||||
| // newRRSIG returns a new RRSIG, with all fields filled out, except the signed data. | ||||
| func (k *DNSKEY) newRRSIG(signerName string, ttl, incep, expir uint32) *dns.RRSIG { | ||||
| 	sig := new(dns.RRSIG) | ||||
|  | ||||
|   | ||||
| @@ -38,7 +38,7 @@ type ResponseWriter struct { | ||||
| 	dnstapErr error | ||||
| } | ||||
|  | ||||
| // DnstapError check if a dnstap error occurred during Write and returns it. | ||||
| // DnstapError checks if a dnstap error occurred during Write and returns it. | ||||
| func (w *ResponseWriter) DnstapError() error { | ||||
| 	return w.dnstapErr | ||||
| } | ||||
|   | ||||
| @@ -95,7 +95,7 @@ Transfer: | ||||
| 	return less(z.Apex.SOA.Serial, uint32(serial)), Err | ||||
| } | ||||
|  | ||||
| // less return true of a is smaller than b when taking RFC 1982 serial arithmetic into account. | ||||
| // less returns true of a is smaller than b when taking RFC 1982 serial arithmetic into account. | ||||
| func less(a, b uint32) bool { | ||||
| 	if a < b { | ||||
| 		return (b - a) <= MaxSerialIncrement | ||||
|   | ||||
| @@ -121,7 +121,7 @@ func (t *Transport) cleanup(all bool) { | ||||
| // It is hard to pin a value to this, the import thing is to no block forever, losing at cached connection is not terrible. | ||||
| const yieldTimeout = 25 * time.Millisecond | ||||
|  | ||||
| // Yield return the connection to transport for reuse. | ||||
| // Yield returns the connection to transport for reuse. | ||||
| func (t *Transport) Yield(pc *persistConn) { | ||||
| 	pc.used = time.Now() // update used time | ||||
|  | ||||
|   | ||||
| @@ -49,7 +49,7 @@ func (k *Kubernetes) AutoPath(state request.Request) []string { | ||||
| 	return search | ||||
| } | ||||
|  | ||||
| // podWithIP return the api.Pod for source IP. It returns nil if nothing can be found. | ||||
| // podWithIP returns the api.Pod for source IP. It returns nil if nothing can be found. | ||||
| func (k *Kubernetes) podWithIP(ip string) *object.Pod { | ||||
| 	if k.podMode != podModeVerified { | ||||
| 		return nil | ||||
|   | ||||
| @@ -42,7 +42,7 @@ type EndpointPort struct { | ||||
| 	Protocol string | ||||
| } | ||||
|  | ||||
| // EndpointsKey return a string using for the index. | ||||
| // EndpointsKey returns a string using for the index. | ||||
| func EndpointsKey(name, namespace string) string { return name + "." + namespace } | ||||
|  | ||||
| // ToEndpoints returns a function that converts an *api.Endpoints to a *Endpoints. | ||||
|   | ||||
| @@ -25,7 +25,7 @@ type Service struct { | ||||
| 	*Empty | ||||
| } | ||||
|  | ||||
| // ServiceKey return a string using for the index. | ||||
| // ServiceKey returns a string using for the index. | ||||
| func ServiceKey(name, namespace string) string { return name + "." + namespace } | ||||
|  | ||||
| // ToService returns a function that converts an api.Service to a *Service. | ||||
|   | ||||
| @@ -99,7 +99,7 @@ func stripUnderscore(s string) string { | ||||
| 	return s[1:] | ||||
| } | ||||
|  | ||||
| // String return a string representation of r, it just returns all fields concatenated with dots. | ||||
| // String returns a string representation of r, it just returns all fields concatenated with dots. | ||||
| // This is mostly used in tests. | ||||
| func (r recordRequest) String() string { | ||||
| 	s := r.port | ||||
|   | ||||
| @@ -73,7 +73,7 @@ func (rule *edns0NsidRule) Rewrite(ctx context.Context, state request.Request) R | ||||
| // Mode returns the processing mode. | ||||
| func (rule *edns0NsidRule) Mode() string { return rule.mode } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *edns0NsidRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| // Rewrite will alter the request EDNS0 local options. | ||||
| @@ -103,7 +103,7 @@ func (rule *edns0LocalRule) Rewrite(ctx context.Context, state request.Request) | ||||
| // Mode returns the processing mode. | ||||
| func (rule *edns0LocalRule) Mode() string { return rule.mode } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *edns0LocalRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| // newEdns0Rule creates an EDNS0 rule of the appropriate type based on the args | ||||
| @@ -253,7 +253,7 @@ func (rule *edns0VariableRule) Rewrite(ctx context.Context, state request.Reques | ||||
| // Mode returns the processing mode. | ||||
| func (rule *edns0VariableRule) Mode() string { return rule.mode } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *edns0VariableRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| func isValidVariable(variable string) bool { | ||||
|   | ||||
| @@ -245,27 +245,27 @@ func (rule *suffixNameRule) Mode() string    { return rule.NextAction } | ||||
| func (rule *substringNameRule) Mode() string { return rule.NextAction } | ||||
| func (rule *regexNameRule) Mode() string     { return rule.NextAction } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *exactNameRule) GetResponseRule() ResponseRule { return rule.ResponseRule } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *prefixNameRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *suffixNameRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *substringNameRule) GetResponseRule() ResponseRule { return ResponseRule{} } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. | ||||
| // GetResponseRule returns a rule to rewrite the response with. | ||||
| func (rule *regexNameRule) GetResponseRule() ResponseRule { return rule.ResponseRule } | ||||
|  | ||||
| // hasClosingDot return true if s has a closing dot at the end. | ||||
| // hasClosingDot returns true if s has a closing dot at the end. | ||||
| func hasClosingDot(s string) bool { | ||||
| 	return strings.HasSuffix(s, ".") | ||||
| } | ||||
|  | ||||
| // getSubExprUsage return the number of subexpressions used in s. | ||||
| // getSubExprUsage returns the number of subexpressions used in s. | ||||
| func getSubExprUsage(s string) int { | ||||
| 	subExprUsage := 0 | ||||
| 	for i := 0; i <= 100; i++ { | ||||
| @@ -276,7 +276,7 @@ func getSubExprUsage(s string) int { | ||||
| 	return subExprUsage | ||||
| } | ||||
|  | ||||
| // isValidRegexPattern return a regular expression for pattern matching or errors, if any. | ||||
| // isValidRegexPattern returns a regular expression for pattern matching or errors, if any. | ||||
| func isValidRegexPattern(rewriteFrom, rewriteTo string) (*regexp.Regexp, error) { | ||||
| 	rewriteFromPattern, err := regexp.Compile(rewriteFrom) | ||||
| 	if err != nil { | ||||
|   | ||||
| @@ -183,27 +183,27 @@ func (rule *suffixTTLRule) Mode() string    { return rule.NextAction } | ||||
| func (rule *substringTTLRule) Mode() string { return rule.NextAction } | ||||
| func (rule *regexTTLRule) Mode() string     { return rule.NextAction } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *exactTTLRule) GetResponseRule() ResponseRule { | ||||
| 	return rule.ResponseRule | ||||
| } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *prefixTTLRule) GetResponseRule() ResponseRule { | ||||
| 	return rule.ResponseRule | ||||
| } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *suffixTTLRule) GetResponseRule() ResponseRule { | ||||
| 	return rule.ResponseRule | ||||
| } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. Currently not implemented. | ||||
| // GetResponseRule returns a rule to rewrite the response with. Currently not implemented. | ||||
| func (rule *substringTTLRule) GetResponseRule() ResponseRule { | ||||
| 	return rule.ResponseRule | ||||
| } | ||||
|  | ||||
| // GetResponseRule return a rule to rewrite the response with. | ||||
| // GetResponseRule returns a rule to rewrite the response with. | ||||
| func (rule *regexTTLRule) GetResponseRule() ResponseRule { | ||||
| 	return rule.ResponseRule | ||||
| } | ||||
|   | ||||
| @@ -112,7 +112,7 @@ func OPT(bufsize int, do bool) *dns.OPT { | ||||
| 	return o | ||||
| } | ||||
|  | ||||
| // Header test if the header in resp matches the header as defined in tc. | ||||
| // Header tests if the header in resp matches the header as defined in tc. | ||||
| func Header(tc Case, resp *dns.Msg) error { | ||||
| 	if resp.Rcode != tc.Rcode { | ||||
| 		return fmt.Errorf("rcode is %q, expected %q", dns.RcodeToString[resp.Rcode], dns.RcodeToString[tc.Rcode]) | ||||
|   | ||||
| @@ -38,22 +38,22 @@ func (t *ResponseWriter) RemoteAddr() net.Addr { | ||||
| 	return &net.UDPAddr{IP: ip, Port: port, Zone: ""} | ||||
| } | ||||
|  | ||||
| // WriteMsg implement dns.ResponseWriter interface. | ||||
| // WriteMsg implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) WriteMsg(m *dns.Msg) error { return nil } | ||||
|  | ||||
| // Write implement dns.ResponseWriter interface. | ||||
| // Write implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) Write(buf []byte) (int, error) { return len(buf), nil } | ||||
|  | ||||
| // Close implement dns.ResponseWriter interface. | ||||
| // Close implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) Close() error { return nil } | ||||
|  | ||||
| // TsigStatus implement dns.ResponseWriter interface. | ||||
| // TsigStatus implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) TsigStatus() error { return nil } | ||||
|  | ||||
| // TsigTimersOnly implement dns.ResponseWriter interface. | ||||
| // TsigTimersOnly implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) TsigTimersOnly(bool) {} | ||||
|  | ||||
| // Hijack implement dns.ResponseWriter interface. | ||||
| // Hijack implements dns.ResponseWriter interface. | ||||
| func (t *ResponseWriter) Hijack() {} | ||||
|  | ||||
| // ResponseWriter6 returns fixed client and remote address in IPv6.  The remote | ||||
|   | ||||
| @@ -77,7 +77,7 @@ func Scrape(url string) []*MetricFamily { | ||||
| 	return result | ||||
| } | ||||
|  | ||||
| // ScrapeMetricAsInt provide a sum of all metrics collected for the name and label provided. | ||||
| // ScrapeMetricAsInt provides a sum of all metrics collected for the name and label provided. | ||||
| // if the metric is not a numeric value, it will be counted a 0. | ||||
| func ScrapeMetricAsInt(addr string, name string, label string, nometricvalue int) int { | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user