validate object implements the corresponding interface (#3724)

Signed-off-by: zouyee <zounengren@cmss.chinamobile.com>
This commit is contained in:
Zou Nengren
2020-03-06 16:25:07 +08:00
committed by GitHub
parent b8e96b61fc
commit a74a209129
5 changed files with 20 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ import (
"github.com/coredns/coredns/plugin/pkg/response"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/caddyserver/caddy"
)
// ServerHTTPS represents an instance of a DNS-over-HTTPS server.
@@ -44,6 +46,9 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
return sh, nil
}
// Compile-time check to ensure Server implements the caddy.GracefulServer interface
var _ caddy.GracefulServer = &Server{}
// Serve implements caddy.TCPServer interface.
func (s *ServerHTTPS) Serve(l net.Listener) error {
s.m.Lock()