Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
DNS Witch
Nomilo
Commits
a6bb2b8f
Commit
a6bb2b8f
authored
Mar 20, 2021
by
Gaël Berthaud-Müller
Browse files
add support for srv, sshfp, txt
parent
c4c6e718
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
src/models/dns.rs
src/models/dns.rs
+30
-3
src/models/mod.rs
src/models/mod.rs
+1
-1
No files found.
src/models/dns.rs
View file @
a6bb2b8f
...
...
@@ -62,11 +62,25 @@ pub enum RData {
minimum
:
u32
,
serial
:
u32
},
// SRV(SRV),
// SSHFP(SSHFP),
#[serde(rename_all
=
"PascalCase"
)]
SRV
{
server
:
String
,
port
:
u16
,
priority
:
u16
,
weight
:
u16
,
},
#[serde(rename_all
=
"PascalCase"
)]
SSHFP
{
algorithm
:
u8
,
digest_type
:
u8
,
fingerprint
:
String
,
},
// SVCB(SVCB),
// TLSA(TLSA),
// TXT(TXT),
#[serde(rename_all
=
"PascalCase"
)]
TXT
{
text
:
String
},
// TODO: Eventually allow deserialization of DNSSEC records
#[serde(skip)]
...
...
@@ -120,11 +134,24 @@ impl From<trust_dns_types::RData> for RData {
minimum
:
soa
.minimum
(),
serial
:
soa
.serial
()
},
trust_dns_types
::
RData
::
SRV
(
srv
)
=>
RData
::
SRV
{
server
:
srv
.target
()
.to_utf8
(),
port
:
srv
.port
(),
priority
:
srv
.priority
(),
weight
:
srv
.weight
(),
},
trust_dns_types
::
RData
::
SSHFP
(
sshfp
)
=>
RData
::
SSHFP
{
algorithm
:
sshfp
.algorithm
()
.into
(),
digest_type
:
sshfp
.fingerprint_type
()
.into
(),
fingerprint
:
trust_dns_types
::
sshfp
::
HEX
.encode
(
sshfp
.fingerprint
()),
},
trust_dns_types
::
RData
::
TXT
(
txt
)
=>
RData
::
TXT
{
text
:
format!
(
"{}"
,
txt
)
},
trust_dns_types
::
RData
::
DNSSEC
(
data
)
=>
RData
::
DNSSEC
(
data
),
rdata
=>
{
let
code
=
rdata
.to_record_type
()
.into
();
let
mut
data
=
Vec
::
new
();
let
mut
encoder
=
BinEncoder
::
new
(
&
mut
data
);
// TODO: need better error handling (use TryFrom ?)
rdata
.emit
(
&
mut
encoder
)
.expect
(
"could not encode data"
);
RData
::
Unknown
{
...
...
src/models/mod.rs
View file @
a6bb2b8f
...
...
@@ -3,7 +3,7 @@ pub mod errors;
pub
mod
trust_dns_types
{
pub
use
trust_dns_client
::
rr
::
rdata
::{
NULL
,
caa
,
DNSSECRData
DNSSECRData
,
caa
,
sshfp
,
};
pub
use
trust_dns_client
::
rr
::{
RData
,
DNSClass
,
Record
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment