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
|
// spawn the server
|
||||||
handler := s.make_handler(fqdn, content)
|
handler := s.make_handler(fqdn, content)
|
||||||
// could also use fqdn as pattern, but "." allows logging invalid requests
|
server := &dns.Server{
|
||||||
dns.HandleFunc(".", handler)
|
Addr: s.Address,
|
||||||
server := &dns.Server{Addr: s.Address, Net: "udp", TsigSecret: nil}
|
Net: "udp",
|
||||||
|
Handler: handler,
|
||||||
|
TsigSecret: nil,
|
||||||
|
}
|
||||||
go s.serve(server)
|
go s.serve(server)
|
||||||
|
|
||||||
// store the server for shutdown later
|
// store the server for shutdown later
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue