Skip to content

Commit

Permalink
add support for subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vandot committed Dec 5, 2023
1 parent dbcd173 commit 23c7905
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lodns.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.1.8"
version = "0.1.9"
author = "vandot"
description = "Simple DNS server for local development"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/lodnspkg/server.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ proc serve*(ip: string, port: int, tld: string) =
else:
log("error", "type=", message.questions[0].qtype, " domain=", domain, " error=unsupported-type")
rr = initResourceRecord(domain, Type.NULL, Class.IN, 0'i32, 0'u16, RDataNULL())
if rsplit(domain, ".", maxsplit=2)[1] != tld:
if not endsWith(domain, tld & "."):
log("error", "type=", message.questions[0].qtype, " domain=", domain, " error=unsupported-domain")
rr = initResourceRecord(domain, Type.NULL, Class.IN, 0'i32, 0'u16, RDataNULL())
let header = initHeader(message.header.id, QR.Response)
Expand Down

0 comments on commit 23c7905

Please sign in to comment.