Fix DNS request context marshaling

This commit is contained in:
Daniel
2021-11-17 17:28:30 +01:00
parent 938a43c300
commit f4e3eff0bd

View File

@@ -2,6 +2,7 @@ package nsutil
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
@@ -45,6 +46,11 @@ func (rf ResponderFunc) ReplyWithDNS(ctx context.Context, request *dns.Msg) *dns
return rf(ctx, request)
}
// MarshalJSON disables JSON marshaling for ResponderFunc.
func (rf ResponderFunc) MarshalJSON() ([]byte, error) {
return json.Marshal(nil)
}
// BlockIP is a ResponderFunc than replies with either 0.0.0.17 or ::17 for
// each A or AAAA question respectively. If there is no A or AAAA question, it
// defaults to replying with NXDomain.