diff --git a/prime.go b/prime.go index 28eba38..4e05ad5 100644 --- a/prime.go +++ b/prime.go @@ -33,8 +33,16 @@ func HandlePrimeNumberChecker(question dns.Question) dns.RR { log.Println("4") if isQuestionPartIndex == 0 || isQuestionPartIndex == 1 { log.Println("5") - // TODO handle resource found - return nil + // handle resource found + return &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "tiamat.cringe-studios.com.", + } } isnotQuestionPartIndex := strings.LastIndex(question.Name, "isnot.prime.cringe-studios.com") @@ -42,7 +50,16 @@ func HandlePrimeNumberChecker(question dns.Question) dns.RR { if isnotQuestionPartIndex == 0 || isnotQuestionPartIndex == 1 { // TODO handle resource found log.Println("7") - return nil + + return &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "marduk.cringe-studios.com.", + } } maybeQuestionPartIndex := strings.LastIndex(question.Name, "maybe.prime.cringe-studios.com") @@ -50,7 +67,16 @@ func HandlePrimeNumberChecker(question dns.Question) dns.RR { if maybeQuestionPartIndex == 0 || maybeQuestionPartIndex == 1 { // TODO handle resource found log.Println("9") - return nil + + return &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "server.cringe-studios.com.", + } } mainDomainPart := question.Name[0:mainDomainPartindex] // subtract 1 for the p in prime @@ -92,9 +118,17 @@ func HandlePrimeNumberChecker(question dns.Question) dns.RR { log.Println("16.5") if !IsNumber(mainDomainPart) { - // TODO return cname to isnot.prime.cringe-studios.com + // return cname to isnot.prime.cringe-studios.com log.Println("17") - return nil + return &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "isnot.prime.cringe-studios.com.", + } } log.Println("18") @@ -106,11 +140,19 @@ func HandlePrimeNumberChecker(question dns.Question) dns.RR { if bigNumber.Cmp(maximumPrimeNumber) == 1 { // number is bigger than the maximum limit for the propablyprime function - // TODO return CNAME for maybe.prime.cringe-studios.com + // return CNAME for maybe.prime.cringe-studios.com log.Println("20") - return nil + return &dns.CNAME{ + Hdr: dns.RR_Header{ + Name: question.Name, + Rrtype: dns.TypeCNAME, + Class: dns.ClassINET, + Ttl: 30, + }, + Target: "maybe.prime.cringe-studios.com.", + } } if bigNumber.ProbablyPrime(20) {