@@ -145,13 +145,24 @@ func (p *piholeClient) listRecords(ctx context.Context, rtype string) ([]*endpoi
145
145
if ! ok {
146
146
return out , nil
147
147
}
148
+ loop:
148
149
for _ , rec := range data {
149
150
name := rec [0 ]
150
151
target := rec [1 ]
151
152
if ! p .cfg .DomainFilter .Match (name ) {
152
153
log .Debugf ("Skipping %s that does not match domain filter" , name )
153
154
continue
154
155
}
156
+ switch rtype {
157
+ case endpoint .RecordTypeA :
158
+ if strings .Contains (target , ":" ) {
159
+ continue loop
160
+ }
161
+ case endpoint .RecordTypeAAAA :
162
+ if strings .Contains (target , "." ) {
163
+ continue loop
164
+ }
165
+ }
155
166
out = append (out , & endpoint.Endpoint {
156
167
DNSName : name ,
157
168
Targets : []string {target },
@@ -180,7 +191,7 @@ func (p *piholeClient) cnameRecordsScript() string {
180
191
181
192
func (p * piholeClient ) urlForRecordType (rtype string ) (string , error ) {
182
193
switch rtype {
183
- case endpoint .RecordTypeA :
194
+ case endpoint .RecordTypeA , endpoint . RecordTypeAAAA :
184
195
return p .aRecordsScript (), nil
185
196
case endpoint .RecordTypeCNAME :
186
197
return p .cnameRecordsScript (), nil
@@ -287,7 +298,7 @@ func (p *piholeClient) newDNSActionForm(action string, ep *endpoint.Endpoint) *u
287
298
form .Add ("action" , action )
288
299
form .Add ("domain" , ep .DNSName )
289
300
switch ep .RecordType {
290
- case endpoint .RecordTypeA :
301
+ case endpoint .RecordTypeA , endpoint . RecordTypeAAAA :
291
302
form .Add ("ip" , ep .Targets [0 ])
292
303
case endpoint .RecordTypeCNAME :
293
304
form .Add ("target" , ep .Targets [0 ])
0 commit comments