coredns/middleware/etcd/debug.go
Miek Gieben 27d893cf33 ServiceBackend interface (#369)
* Add ServiceBackend interface

This adds a ServiceBackend interface that is shared between etcd/etcd3
(later) and kubernetes, leading to a massive reduction in code. When
returning the specific records from their backend.

Fixes #273
2016-10-30 15:54:16 +00:00

20 lines
522 B
Go

package etcd
import "strings"
const debugName = "o-o.debug."
// isDebug checks if name is a debugging name, i.e. starts with o-o.debug.
// it return the empty string if it is not a debug message, otherwise it will return the
// name with o-o.debug. stripped off. Must be called with name lowercased.
func isDebug(name string) string {
if len(name) == len(debugName) {
return ""
}
name = strings.ToLower(name)
debug := strings.HasPrefix(name, debugName)
if !debug {
return ""
}
return name[len(debugName):]
}