fix: remove hidden global state
dns.HandleFunc(".", handler) modifies the global dns.DefaultServeMux and
dns.Server uses that if it is initialized without a Handler. This would
cause issues when multiple instances of the module try to Present() at
the same time.
This commit is contained in:
parent
769d017d22
commit
71d1f19169
1 changed files with 6 additions and 3 deletions
9
stub.go
9
stub.go
|
|
@ -116,9 +116,12 @@ func (s *StubDNS) Present(ctx context.Context, challenge acme.Challenge) error {
|
|||
|
||||
// spawn the server
|
||||
handler := s.make_handler(fqdn, content)
|
||||
// could also use fqdn as pattern, but "." allows logging invalid requests
|
||||
dns.HandleFunc(".", handler)
|
||||
server := &dns.Server{Addr: s.Address, Net: "udp", TsigSecret: nil}
|
||||
server := &dns.Server{
|
||||
Addr: s.Address,
|
||||
Net: "udp",
|
||||
Handler: handler,
|
||||
TsigSecret: nil,
|
||||
}
|
||||
go s.serve(server)
|
||||
|
||||
// store the server for shutdown later
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue