Skip to content

Commit

Permalink
Fix some typos in comments. (coredns#4100)
Browse files Browse the repository at this point in the history
Signed-off-by: Hu Shuai <[email protected]>
  • Loading branch information
hs0210 authored Sep 1, 2020
1 parent 9e4a177 commit e233f59
Show file tree
Hide file tree
Showing 24 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion core/dnsserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion core/dnsserver/onstartup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion core/dnsserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion core/dnsserver/server_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion core/dnsserver/server_https.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion core/dnsserver/server_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion plugin/autopath/autopath.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/dnssec/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugin/dnssec/responsewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/dnssec/rrsig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion plugin/dnstap/taprw/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/file/secondary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/forward/persistent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion plugin/kubernetes/autopath.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/kubernetes/object/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion plugin/kubernetes/object/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion plugin/kubernetes/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions plugin/rewrite/edns0.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions plugin/rewrite/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++ {
Expand All @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions plugin/rewrite/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/test/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
12 changes: 6 additions & 6 deletions plugin/test/responsewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/test/scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down

0 comments on commit e233f59

Please sign in to comment.