Skip to content

Commit

Permalink
Report which adlist
Browse files Browse the repository at this point in the history
  • Loading branch information
Doridian committed Mar 8, 2025
1 parent b99a5aa commit a318d51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion generator/blackhole/adlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package blackhole

import (
"context"
"fmt"
"io"
"log"
"net"
Expand Down Expand Up @@ -44,7 +45,7 @@ func NewAdlist(url string, mux *dns.ServeMux, refreshInterval time.Duration) *Ad
return &Adlist{
url: url,
mux: mux,
handler: New(),
handler: New(fmt.Sprintf("adlist: %s", url)),
managedHosts: make(map[string]bool),
refreshInterval: refreshInterval,
}
Expand Down
9 changes: 6 additions & 3 deletions generator/blackhole/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import (
)

type Generator struct {
reason string
}

func New() *Generator {
return &Generator{}
func New(reason string) *Generator {
return &Generator{
reason: reason,
}
}

func (r *Generator) ServeDNS(wr dns.ResponseWriter, msg *dns.Msg) {
Expand All @@ -24,7 +27,7 @@ func (r *Generator) ServeDNS(wr dns.ResponseWriter, msg *dns.Msg) {
if ok {
option = append(option, &dns.EDNS0_EDE{
InfoCode: dns.ExtendedErrorCodeFiltered,
ExtraText: "blackholed",
ExtraText: r.reason,
})
util.ApplyEDNS0Reply(msg, reply, option, wr, false)
}
Expand Down

0 comments on commit a318d51

Please sign in to comment.