Compare commits

...

2 Commits

Author SHA1 Message Date
matt
e3a689623b add private 2026-05-13 11:09:33 -07:00
matt
e8d0d4e6b1 refactor: improve code quality and add automation
- Remove unnecessary return statement in auth module
- Comment out unused 'code' field in ResponseError struct
- Improve readme formatting with proper markdown
- Update dependencies in Cargo.lock
- Add Makefile with DNS record update automation commands
2025-11-24 19:50:46 -08:00
5 changed files with 701 additions and 372 deletions

1034
Cargo.lock generated

File diff suppressed because it is too large Load Diff

21
Makefile Normal file
View File

@@ -0,0 +1,21 @@
.PHONY: public private sbw
all: public private sbw
public:
cargo run delete --record-type a --domain publicmatt.com --name "@"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain publicmatt.com --name "@" --data {}
cargo run delete --record-type a --domain publicmatt.com --name "*"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain publicmatt.com --name "*" --data {}
sbw:
cargo run delete --record-type a --domain sailboatworld.com --name "@"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain sailboatworld.com --name "@" --data {}
cargo run delete --record-type a --domain sailboatworld.com --name "*"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain sailboatworld.com --name "*" --data {}
private:
cargo run delete --record-type a --domain privatematt.com --name "@"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain privatematt.com --name "@" --data {}
cargo run delete --record-type a --domain privatematt.com --name "*"
curl ipinfo.io/ip | xargs -I {} cargo run update --record-type a --domain privatematt.com --name "*" --data {}

View File

@@ -1,18 +1,21 @@
# GoDaddy DDNS
![godaddy-ddns](https://user-images.githubusercontent.com/4237627/147422997-f72018be-7f60-4e56-9a52-d2ac81e0dbd5.png)
## What is this?
It's a Rust application to update GoDaddy DNS Records via REST API.
## Usage
It order for the application to work, there needs to be:
It order for the application to work, there needs to be:
* Environment variables:
* `DOMAIN` - The domain to update
* `KEY` - GoDaddy API Key
* `SECRET` - GoDaddy API SECRET
Info about how to generate the **KEY** and the **SECRET** can be found here: https://developer.godaddy.com/getstarted
Info about how to generate the **KEY** and the **SECRET** can be found here: <https://developer.godaddy.com/getstarted>
* A file called `records.json` placed in `$HOME/.godaddy-ddns` with the following structure:
@@ -36,10 +39,10 @@ Info about how to generate the **KEY** and the **SECRET** can be found here: htt
}
```
### Fields of interest
### Fields of interest
* name: `{string}` - Name of the record.
* record_type: `{string}` - Type of the record (A, AAAA, CAA, CNAME, MX, NS, SRV, TXT).
* record_type: `{string}` - Type of the record (A, AAAA, CAA, CNAME, MX, NS, SRV, TXT).
* data: `{string}` (optional) - Value of the record. (Useful in case of a hard-coded record or interpolation)
* interpolate: `{boolean}` (optional) - When set to true, the application will write the current ip in the {ip} tag of the data field.
@@ -64,6 +67,3 @@ Example of use (with a given IP of 8.8.8.8) :
}
```

View File

@@ -12,6 +12,6 @@ pub struct Auth {
impl Auth {
pub fn as_header(&self) -> String {
let header = format!("sso-key {}:{}", self.key, self.secret);
return header;
header
}
}

View File

@@ -12,7 +12,7 @@ pub enum Api {
#[derive(Deserialize, Debug)]
pub struct ResponseError {
pub code: String,
// pub code: String,
pub message: String,
pub fields: Vec<ResponseField>,
}