Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
a74a2091
Commit
a74a2091
authored
Mar 06, 2020
by
Zou Nengren
Committed by
GitHub
Mar 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validate object implements the corresponding interface (#3724)
Signed-off-by:
zouyee
<
zounengren@cmss.chinamobile.com
>
parent
b8e96b61
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
0 deletions
+20
-0
core/dnsserver/register.go
core/dnsserver/register.go
+3
-0
core/dnsserver/server.go
core/dnsserver/server.go
+4
-0
core/dnsserver/server_grpc.go
core/dnsserver/server_grpc.go
+4
-0
core/dnsserver/server_https.go
core/dnsserver/server_https.go
+5
-0
core/dnsserver/server_tls.go
core/dnsserver/server_tls.go
+4
-0
No files found.
core/dnsserver/register.go
View file @
a74a2091
...
@@ -52,6 +52,9 @@ func (h *dnsContext) saveConfig(key string, cfg *Config) {
...
@@ -52,6 +52,9 @@ func (h *dnsContext) saveConfig(key string, cfg *Config) {
h
.
keysToConfigs
[
key
]
=
cfg
h
.
keysToConfigs
[
key
]
=
cfg
}
}
// Compile-time check to ensure dnsContext implements the caddy.Context interface
var
_
caddy
.
Context
=
&
dnsContext
{}
// InspectServerBlocks make sure that everything checks out before
// InspectServerBlocks make sure that everything checks out before
// executing directives and otherwise prepares the directives to
// executing directives and otherwise prepares the directives to
// be parsed and executed.
// be parsed and executed.
...
...
core/dnsserver/server.go
View file @
a74a2091
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/coredns/coredns/request"
"github.com/coredns/coredns/request"
"github.com/caddyserver/caddy"
"github.com/miekg/dns"
"github.com/miekg/dns"
ot
"github.com/opentracing/opentracing-go"
ot
"github.com/opentracing/opentracing-go"
)
)
...
@@ -99,6 +100,9 @@ func NewServer(addr string, group []*Config) (*Server, error) {
...
@@ -99,6 +100,9 @@ func NewServer(addr string, group []*Config) (*Server, error) {
return
s
,
nil
return
s
,
nil
}
}
// Compile-time check to ensure Server implements the caddy.GracefulServer interface
var
_
caddy
.
GracefulServer
=
&
Server
{}
// Serve starts the server with an existing listener. It blocks until the server stops.
// Serve starts the server with an existing listener. It blocks until the server stops.
// This implements caddy.TCPServer interface.
// This implements caddy.TCPServer interface.
func
(
s
*
Server
)
Serve
(
l
net
.
Listener
)
error
{
func
(
s
*
Server
)
Serve
(
l
net
.
Listener
)
error
{
...
...
core/dnsserver/server_grpc.go
View file @
a74a2091
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/caddyserver/caddy"
"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/miekg/dns"
"github.com/miekg/dns"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go"
...
@@ -43,6 +44,9 @@ func NewServergRPC(addr string, group []*Config) (*ServergRPC, error) {
...
@@ -43,6 +44,9 @@ func NewServergRPC(addr string, group []*Config) (*ServergRPC, error) {
return
&
ServergRPC
{
Server
:
s
,
tlsConfig
:
tlsConfig
},
nil
return
&
ServergRPC
{
Server
:
s
,
tlsConfig
:
tlsConfig
},
nil
}
}
// Compile-time check to ensure Server implements the caddy.GracefulServer interface
var
_
caddy
.
GracefulServer
=
&
Server
{}
// Serve implements caddy.TCPServer interface.
// Serve implements caddy.TCPServer interface.
func
(
s
*
ServergRPC
)
Serve
(
l
net
.
Listener
)
error
{
func
(
s
*
ServergRPC
)
Serve
(
l
net
.
Listener
)
error
{
s
.
m
.
Lock
()
s
.
m
.
Lock
()
...
...
core/dnsserver/server_https.go
View file @
a74a2091
...
@@ -14,6 +14,8 @@ import (
...
@@ -14,6 +14,8 @@ import (
"github.com/coredns/coredns/plugin/pkg/response"
"github.com/coredns/coredns/plugin/pkg/response"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/caddyserver/caddy"
)
)
// ServerHTTPS represents an instance of a DNS-over-HTTPS server.
// ServerHTTPS represents an instance of a DNS-over-HTTPS server.
...
@@ -44,6 +46,9 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
...
@@ -44,6 +46,9 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
return
sh
,
nil
return
sh
,
nil
}
}
// Compile-time check to ensure Server implements the caddy.GracefulServer interface
var
_
caddy
.
GracefulServer
=
&
Server
{}
// Serve implements caddy.TCPServer interface.
// Serve implements caddy.TCPServer interface.
func
(
s
*
ServerHTTPS
)
Serve
(
l
net
.
Listener
)
error
{
func
(
s
*
ServerHTTPS
)
Serve
(
l
net
.
Listener
)
error
{
s
.
m
.
Lock
()
s
.
m
.
Lock
()
...
...
core/dnsserver/server_tls.go
View file @
a74a2091
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/coredns/coredns/plugin/pkg/transport"
"github.com/caddyserver/caddy"
"github.com/miekg/dns"
"github.com/miekg/dns"
)
)
...
@@ -35,6 +36,9 @@ func NewServerTLS(addr string, group []*Config) (*ServerTLS, error) {
...
@@ -35,6 +36,9 @@ func NewServerTLS(addr string, group []*Config) (*ServerTLS, error) {
return
&
ServerTLS
{
Server
:
s
,
tlsConfig
:
tlsConfig
},
nil
return
&
ServerTLS
{
Server
:
s
,
tlsConfig
:
tlsConfig
},
nil
}
}
// Compile-time check to ensure Server implements the caddy.GracefulServer interface
var
_
caddy
.
GracefulServer
=
&
Server
{}
// Serve implements caddy.TCPServer interface.
// Serve implements caddy.TCPServer interface.
func
(
s
*
ServerTLS
)
Serve
(
l
net
.
Listener
)
error
{
func
(
s
*
ServerTLS
)
Serve
(
l
net
.
Listener
)
error
{
s
.
m
.
Lock
()
s
.
m
.
Lock
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment