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
d7f8202d
Commit
d7f8202d
authored
Jun 23, 2022
by
Ondřej Benkovský
Committed by
GitHub
Jun 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log DoH HTTP server error logs in CoreDNS format (#5457)
Signed-off-by:
Ondřej Benkovský
<
ondrej.benkovsky@jamf.com
>
parent
89ff12b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
core/dnsserver/server_https.go
core/dnsserver/server_https.go
+12
-0
No files found.
core/dnsserver/server_https.go
View file @
d7f8202d
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"context"
"context"
"crypto/tls"
"crypto/tls"
"fmt"
"fmt"
stdlog
"log"
"net"
"net"
"net/http"
"net/http"
"strconv"
"strconv"
...
@@ -13,6 +14,7 @@ import (
...
@@ -13,6 +14,7 @@ import (
"github.com/coredns/coredns/plugin/metrics/vars"
"github.com/coredns/coredns/plugin/metrics/vars"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/doh"
"github.com/coredns/coredns/plugin/pkg/doh"
clog
"github.com/coredns/coredns/plugin/pkg/log"
"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"
...
@@ -27,6 +29,15 @@ type ServerHTTPS struct {
...
@@ -27,6 +29,15 @@ type ServerHTTPS struct {
validRequest
func
(
*
http
.
Request
)
bool
validRequest
func
(
*
http
.
Request
)
bool
}
}
// loggerAdapter is a simple adapter around CoreDNS logger made to implement io.Writer in order to log errors from HTTP server
type
loggerAdapter
struct
{
}
func
(
l
*
loggerAdapter
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
clog
.
Debug
(
string
(
p
))
return
len
(
p
),
nil
}
// HTTPRequestKey is the context key for the current processed HTTP request (if current processed request was done over DOH)
// HTTPRequestKey is the context key for the current processed HTTP request (if current processed request was done over DOH)
type
HTTPRequestKey
struct
{}
type
HTTPRequestKey
struct
{}
...
@@ -63,6 +74,7 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
...
@@ -63,6 +74,7 @@ func NewServerHTTPS(addr string, group []*Config) (*ServerHTTPS, error) {
ReadTimeout
:
5
*
time
.
Second
,
ReadTimeout
:
5
*
time
.
Second
,
WriteTimeout
:
10
*
time
.
Second
,
WriteTimeout
:
10
*
time
.
Second
,
IdleTimeout
:
120
*
time
.
Second
,
IdleTimeout
:
120
*
time
.
Second
,
ErrorLog
:
stdlog
.
New
(
&
loggerAdapter
{},
""
,
0
),
}
}
sh
:=
&
ServerHTTPS
{
sh
:=
&
ServerHTTPS
{
Server
:
s
,
tlsConfig
:
tlsConfig
,
httpsServer
:
srv
,
validRequest
:
validator
,
Server
:
s
,
tlsConfig
:
tlsConfig
,
httpsServer
:
srv
,
validRequest
:
validator
,
...
...
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