@@ -171,53 +171,53 @@ encode_record(Record, Encoders) ->
171
171
EncodedRecord
172
172
end .
173
173
174
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_SOA , Ttl , Data }) ->
174
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_SOA , ttl = Ttl , data = Data }) ->
175
175
encode_record (Name , Type , Ttl , Data );
176
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_NS , Ttl , Data }) ->
176
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_NS , ttl = Ttl , data = Data }) ->
177
177
encode_record (Name , Type , Ttl , Data );
178
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_A , Ttl , Data }) ->
178
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_A , ttl = Ttl , data = Data }) ->
179
179
encode_record (Name , Type , Ttl , Data );
180
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_AAAA , Ttl , Data }) ->
180
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_AAAA , ttl = Ttl , data = Data }) ->
181
181
encode_record (Name , Type , Ttl , Data );
182
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_CNAME , Ttl , Data }) ->
182
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_CNAME , ttl = Ttl , data = Data }) ->
183
183
encode_record (Name , Type , Ttl , Data );
184
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_MX , Ttl , Data }) ->
184
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_MX , ttl = Ttl , data = Data }) ->
185
185
encode_record (Name , Type , Ttl , Data );
186
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_HINFO , Ttl , Data }) ->
186
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_HINFO , ttl = Ttl , data = Data }) ->
187
187
encode_record (Name , Type , Ttl , Data );
188
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_TXT , Ttl , Data }) ->
188
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_TXT , ttl = Ttl , data = Data }) ->
189
189
encode_record (Name , Type , Ttl , Data );
190
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_SPF , Ttl , Data }) ->
190
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_SPF , ttl = Ttl , data = Data }) ->
191
191
encode_record (Name , Type , Ttl , Data );
192
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_SSHFP , Ttl , Data }) ->
192
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_SSHFP , ttl = Ttl , data = Data }) ->
193
193
encode_record (Name , Type , Ttl , Data );
194
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_SRV , Ttl , Data }) ->
194
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_SRV , ttl = Ttl , data = Data }) ->
195
195
encode_record (Name , Type , Ttl , Data );
196
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_NAPTR , Ttl , Data }) ->
196
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_NAPTR , ttl = Ttl , data = Data }) ->
197
197
encode_record (Name , Type , Ttl , Data );
198
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_CAA , Ttl , Data }) ->
198
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_CAA , ttl = Ttl , data = Data }) ->
199
199
encode_record (Name , Type , Ttl , Data );
200
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_DS , Ttl , Data }) ->
200
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_DS , ttl = Ttl , data = Data }) ->
201
201
encode_record (Name , Type , Ttl , Data );
202
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_CDS , Ttl , Data }) ->
202
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_CDS , ttl = Ttl , data = Data }) ->
203
203
encode_record (Name , Type , Ttl , Data );
204
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_DNSKEY , Ttl , Data }) ->
204
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_DNSKEY , ttl = Ttl , data = Data }) ->
205
205
encode_record (Name , Type , Ttl , Data );
206
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_CDNSKEY , Ttl , Data }) ->
206
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_CDNSKEY , ttl = Ttl , data = Data }) ->
207
207
encode_record (Name , Type , Ttl , Data );
208
- encode_record ({ dns_rr , Name , _ , Type = ? DNS_TYPE_RRSIG , Ttl , Data }) ->
208
+ encode_record (# dns_rr { name = Name , type = Type = ? DNS_TYPE_RRSIG , ttl = Ttl , data = Data }) ->
209
209
encode_record (Name , Type , Ttl , Data );
210
210
encode_record (Record ) ->
211
211
lager :warning (" Unable to encode record (record: ~p )" , [Record ]),
212
212
[].
213
213
214
214
encode_record (Name , Type , Ttl , Data ) ->
215
- [
216
- { <<" name" >>, erlang :iolist_to_binary (io_lib :format (" ~s ." , [Name ]))} ,
217
- { <<" type" >>, dns :type_name (Type )} ,
218
- { <<" ttl" >>, Ttl } ,
219
- { <<" content" >>, encode_data (Data )}
220
- ] .
215
+ #{
216
+ <<" name" >> => erlang :iolist_to_binary (io_lib :format (" ~s ." , [Name ])),
217
+ <<" type" >> => dns :type_name (Type ),
218
+ <<" ttl" >> => Ttl ,
219
+ <<" content" >> => encode_data (Data )
220
+ } .
221
221
222
222
try_custom_encoders (_Record , []) ->
223
223
{};
@@ -262,14 +262,16 @@ encode_data({dns_rrdata_ds, Keytag, Alg, DigestType, Digest}) ->
262
262
encode_data ({dns_rrdata_cds , Keytag , Alg , DigestType , Digest }) ->
263
263
erlang :iolist_to_binary (io_lib :format (" ~w ~w ~w ~s " , [Keytag , Alg , DigestType , Digest ]));
264
264
encode_data ({dns_rrdata_dnskey , Flags , Protocol , Alg , Key , KeyTag }) ->
265
- erlang :iolist_to_binary (io_lib :format (" ~w ~w ~w ~w ~w " , [Flags , Protocol , Alg , Key , KeyTag ]));
265
+ binary : encode_hex ( erlang :iolist_to_binary (io_lib :format (" ~w ~w ~w ~w ~w " , [Flags , Protocol , Alg , Key , KeyTag ]) ));
266
266
encode_data ({dns_rrdata_cdnskey , Flags , Protocol , Alg , Key , KeyTag }) ->
267
- erlang :iolist_to_binary (io_lib :format (" ~w ~w ~w ~w ~w " , [Flags , Protocol , Alg , Key , KeyTag ]));
267
+ binary : encode_hex ( erlang :iolist_to_binary (io_lib :format (" ~w ~w ~w ~w ~w " , [Flags , Protocol , Alg , Key , KeyTag ]) ));
268
268
encode_data ({dns_rrdata_rrsig , TypeCovered , Alg , Labels , OriginalTtl , Expiration , Inception , KeyTag , SignersName , Signature }) ->
269
- erlang :iolist_to_binary (
270
- io_lib :format (
271
- " ~w ~w ~w ~w ~w ~w ~w ~w ~s " ,
272
- [TypeCovered , Alg , Labels , OriginalTtl , Expiration , Inception , KeyTag , SignersName , Signature ]
269
+ binary :encode_hex (
270
+ erlang :iolist_to_binary (
271
+ io_lib :format (
272
+ " ~w ~w ~w ~w ~w ~w ~w ~w ~s " ,
273
+ [TypeCovered , Alg , Labels , OriginalTtl , Expiration , Inception , KeyTag , SignersName , Signature ]
274
+ )
273
275
)
274
276
);
275
277
encode_data (Data ) ->
0 commit comments