feat: refactor and add ip saving
- clean up code to my new (and improved) standards - print better miette diagnostigs for the error tests - add an IP saving feature: save the last IP that successfully updated the records and usa that when restarting the service. This allows seamles upgrades of `webnsupdate` without having to manually trigger a DNS update
This commit is contained in:
parent
8242b83dd9
commit
5745e1aaf7
12 changed files with 646 additions and 353 deletions
16
src/snapshots/webnsupdate__records__test__empty_label.snap
Normal file
16
src/snapshots/webnsupdate__records__test__empty_label.snap
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Fully_qualified_domain_name\(link)]8;;\
|
||||
|
||||
× empty label
|
||||
╭─[test_records_invalid:2:6]
|
||||
1 │ example.com.
|
||||
2 │ name..example.org.
|
||||
· ▲
|
||||
· ╰── label
|
||||
3 │ example.net.
|
||||
╰────
|
||||
help: each label should have at least one character
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Fully_qualified_domain_name\(link)]8;;\
|
||||
|
||||
× hostname too long (260 octets)
|
||||
╭─[test_records_invalid:3:1]
|
||||
2 │ example.org.
|
||||
3 │ example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.example.net.
|
||||
· ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
· ╰── this line
|
||||
4 │ subdomain.example.com.
|
||||
╰────
|
||||
help: fully qualified domain names can be at most 255 characters long
|
16
src/snapshots/webnsupdate__records__test__invalid_ascii.snap
Normal file
16
src/snapshots/webnsupdate__records__test__invalid_ascii.snap
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Hostname#Syntax\(link)]8;;\
|
||||
|
||||
× invalid octet: '\xc3'
|
||||
╭─[test_records_invalid:2:19]
|
||||
1 │ example.com.
|
||||
2 │ name.this-is-not-aßcii.example.org.
|
||||
· ┬
|
||||
· ╰── octet
|
||||
3 │ example.net.
|
||||
╰────
|
||||
help: we only accept ascii characters
|
16
src/snapshots/webnsupdate__records__test__invalid_octet.snap
Normal file
16
src/snapshots/webnsupdate__records__test__invalid_octet.snap
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Hostname#Syntax\(link)]8;;\
|
||||
|
||||
× invalid octet: ':'
|
||||
╭─[test_records_invalid:2:20]
|
||||
1 │ example.com.
|
||||
2 │ name.this-character:-is-not-allowed.example.org.
|
||||
· ┬
|
||||
· ╰── octet
|
||||
3 │ example.net.
|
||||
╰────
|
||||
help: hostnames are only allowed to contain characters in [a-zA-Z0-9_-]
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Fully_qualified_domain_name\(link)]8;;\
|
||||
|
||||
× label too long (78 octets)
|
||||
╭─[test_records_invalid:2:6]
|
||||
1 │ example.com.
|
||||
2 │ name.an-entremely-long-label-that-should-not-exist-because-it-goes-against-the-spec.example.org.
|
||||
· ───────────────────────────────────────┬──────────────────────────────────────
|
||||
· ╰── label
|
||||
3 │ example.net.
|
||||
╰────
|
||||
help: labels should be at most 63 octets
|
16
src/snapshots/webnsupdate__records__test__not_fqd.snap
Normal file
16
src/snapshots/webnsupdate__records__test__not_fqd.snap
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: src/records.rs
|
||||
description: err
|
||||
expression: out
|
||||
---
|
||||
]8;;https://en.wikipedia.org/wiki/Fully_qualified_domain_name\(link)]8;;\
|
||||
|
||||
× not a fully qualified domain name
|
||||
╭─[test_records_invalid:3:11]
|
||||
2 │ example.org.
|
||||
3 │ example.net
|
||||
· ┬
|
||||
· ╰── last character
|
||||
4 │ subdomain.example.com.
|
||||
╰────
|
||||
help: hostname should be a fully qualified domain name (end with a '.')
|
Loading…
Add table
Add a link
Reference in a new issue