Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
senseless committed Sep 22, 2024
1 parent 52bc195 commit 0bb1209
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions powerdns/handlerGetAllDomains.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package powerdns
import "time"

func handleGetAllDomains() Response {

mu.RLock()
defer mu.RUnlock()

currentUnixTimestamp := int(time.Now().Unix())
domains := []DomainInfo{}
for domain := range topLevelDomains {
Expand Down
4 changes: 4 additions & 0 deletions powerdns/handlerGetDomainInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package powerdns
import "time"

func handleGetDomainInfo(params Parameters) Response {

mu.RLock()
defer mu.RUnlock()

currentUnixTimestamp := int(time.Now().Unix())
for _, config := range powerDNSConfigs {
if config.Domain == params.Qname {
Expand Down
1 change: 1 addition & 0 deletions powerdns/handlerGetDomainKeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package powerdns
import "strings"

func handleGetDomainKeys(params Parameters) Response {

mu.RLock()
defer mu.RUnlock()

Expand Down
11 changes: 6 additions & 5 deletions powerdns/handlerLookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package powerdns

import (
"fmt"
"io/ioutil"
"io"
"log"
"math"
"net"
Expand All @@ -12,6 +12,10 @@ import (
)

func handleLookup(params Parameters) Response {

mu.RLock()
defer mu.RUnlock()

domain := strings.ToLower(strings.TrimSuffix(params.Qname, "."))
// log.Printf("Looking up domain: %s, type: %s", domain, params.Qtype)

Expand Down Expand Up @@ -76,9 +80,6 @@ func handleLookup(params Parameters) Response {
}
}

mu.RLock()
defer mu.RUnlock()

var closestMember Member
minDistance := math.MaxFloat64

Expand Down Expand Up @@ -201,7 +202,7 @@ func fetchACMEChallenge(url string) (string, error) {
}
defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("failed to read response body: %w", err)
}
Expand Down

0 comments on commit 0bb1209

Please sign in to comment.