Skip to content

Commit

Permalink
- More fixes (#655)
Browse files Browse the repository at this point in the history
* fix: cli startup, using tracing not log
* fix: stack overflow due to deref/borrow loop
  • Loading branch information
yaleman authored Jan 12, 2025
1 parent 48d65d4 commit db34ab3
Show file tree
Hide file tree
Showing 31 changed files with 618 additions and 624 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ base64 = "0.22.1"
bit-vec = "0.8.0"
bytes = "1.9.0"
chrono = { version = "0.4.39", features = ["clock"] }
clap = { version = "4.5.23", features = ["cargo"] }
clap = { version = "4.5.23", features = ["cargo", "env"] }
concread = "0.5.3"
config = { version = "0.15", features = ["json"] }
dialoguer = "0.11.0"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ COPY --from=builder /goatns/static_files /static_files

WORKDIR /
USER nonroot
ENTRYPOINT ["./goatns"]
ENTRYPOINT ["./goatns", "server"]
169 changes: 90 additions & 79 deletions examples/test_config/zones.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,131 @@
[
{
"name" : "hello.goat",
"rname" : "billy@hello.goat",
"serial" : 1,
"refresh" : 2,
"retry" : 3,
"expire" : 4,
"minimum" : 60,
"records" :
[
{
"name" : "foo.12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"rrtype" : "TXT",
"rdata" : "1",
"ttl" : 1,
"class" : "IN"
"name": "hello.goat",
"rname": "billy@hello.goat",
"serial": 1,
"refresh": 2,
"retry": 3,
"expire": 4,
"minimum": 60,
"records": [
{
"name": "foo.12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"rrtype": "TXT",
"rdata": "1",
"ttl": 1,
"class": "IN"
},

{
"rrtype" : "URI",
"ttl" : 5,
"name" : "_mqtt._http",
"rdata" : "1 2 mqtt://example.goat"
"rrtype": "URI",
"ttl": 5,
"name": "_mqtt._http",
"rdata": "1 2 mqtt://example.goat"
},
{
"rrtype" : "NS",
"rdata" : "ns1.hello.goat",
"ttl" : 3600
"rrtype": "NS",
"rdata": "ns1.hello.goat",
"ttl": 3600
},
{
"rrtype" : "MX",
"ttl" : 60,
"rdata" : "10 mx.hello.goat"
"rrtype": "MX",
"ttl": 60,
"rdata": "10 mx.hello.goat"
},
{
"rrtype" : "MX",
"ttl" : 60,
"rdata" : "150 mx2.hello.goat"
"rrtype": "MX",
"ttl": 60,
"rdata": "150 mx2.hello.goat"
},
{
"name" : "fooptr",
"rrtype" : "PTR",
"rdata" : "ns1.hello.goat",
"ttl" : 3600
"name": "fooptr",
"rrtype": "PTR",
"rdata": "ns1.hello.goat",
"ttl": 3600
},
{
"rrtype" : "NS",
"rdata" : "ns2.hello.goat",
"ttl" : 300
"rrtype": "NS",
"rdata": "ns2.hello.goat",
"ttl": 300
},
{
"name" : "test",
"rrtype" : "A",
"rdata" : "1.2.3.4",
"ttl" : 60
"rrtype": "A",
"name": "ns1.hello.goat",
"rdata": "192.168.0.1",
"ttl": 300
},
{
"name" : "test",
"rrtype" : "A",
"rdata" : "12.2.3.4",
"ttl" : 60
"rrtype": "A",
"name": "ns2.hello.goat",
"rdata": "192.168.0.2",
"ttl": 300
},
{
"name" : "@",
"rrtype" : "A",
"rdata" : "6.6.6.6",
"ttl" : 60
"name": "test",
"rrtype": "A",
"rdata": "1.2.3.4",
"ttl": 60
},
{
"name" : "a",
"rrtype" : "A",
"rdata" : "1.2.3.5",
"ttl" : 60
"name": "test",
"rrtype": "A",
"rdata": "12.2.3.4",
"ttl": 60
},
{
"name" : "aaaa" ,
"rrtype" : "AAAA",
"rdata" : "1234:5678:cafe:beef:ca75:0:4b9:e94d",
"ttl" : 60
"name": "@",
"rrtype": "A",
"rdata": "6.6.6.6",
"ttl": 60
},
{
"name" : "cafe",
"rrtype" : "AAAA",
"rdata" : "fe80:580a:2d::caf3:b33f",
"ttl" : 60
"name": "a",
"rrtype": "A",
"rdata": "1.2.3.5",
"ttl": 60
},
{
"name" : "cafe",
"rrtype" : "TXT",
"rdata" : "Hello world",
"ttl" : 60
"name": "aaaa",
"rrtype": "AAAA",
"rdata": "1234:5678:cafe:beef:ca75:0:4b9:e94d",
"ttl": 60
},
{
"name" : "ttltest",
"rrtype" : "A",
"rdata" : "1.1.1.1",
"ttl" : 1
"name": "cafe",
"rrtype": "AAAA",
"rdata": "fe80:580a:2d::caf3:b33f",
"ttl": 60
},
{
"name" : "ttltest",
"rrtype" : "AAAA",
"rdata" : "2001::cafe:beeef",
"ttl" : 2
"name": "cafe",
"rrtype": "TXT",
"rdata": "Hello world",
"ttl": 60
},
{
"name" : "ttltest",
"rrtype" : "A",
"rdata" : "2.2.2.2",
"ttl" : 2
"name": "ttltest",
"rrtype": "A",
"rdata": "1.1.1.1",
"ttl": 1
},
{
"name": "ttltest",
"rrtype": "AAAA",
"rdata": "2001::cafe:beeef",
"ttl": 2
},
{
"name": "ttltest",
"rrtype": "A",
"rdata": "2.2.2.2",
"ttl": 2
},

{
"name" : "ttltest",
"rrtype" : "A",
"rdata" : "3.3.3.3",
"ttl" : 3
"name": "ttltest",
"rrtype": "A",
"rdata": "3.3.3.3",
"ttl": 3
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion goatns-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ use proc_macro::TokenStream;
pub fn check_api_auth(_item: TokenStream) -> TokenStream {
// TODO: This is terrible
r#"
use tracing::debug;
let user: User = match session.get("user").await.expect("This shouldn't happen!") {
Some(val) => val,
None => {
#[cfg(test)]
println!("User not found in api_create call");
#[cfg(not(test))]
log::debug!("User not found in api_create call");
debug!("User not found in api_create call");
return error_result_json!("", StatusCode::FORBIDDEN);
}
};
Expand Down
Loading

0 comments on commit db34ab3

Please sign in to comment.