Skip to content

Commit

Permalink
lowercase for dns
Browse files Browse the repository at this point in the history
  • Loading branch information
pfandzelter committed May 10, 2024
1 parent 7a42491 commit a79fdc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type Server struct {
// https://gist.github.com/walm/0d67b4fb2d5daf3edd4fad3e13b162cb

func (d *Server) getIPFromDNS(qName string) (string, error) {
// lowercase everything, just in case
qName = strings.ToLower(qName)

labels := dns.SplitDomainName(qName)

if len(labels) != 3 {
Expand Down
11 changes: 10 additions & 1 deletion pkg/orchestrator/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package orchestrator

import (
"net"
"strings"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -73,7 +74,15 @@ func (o *Orchestrator) InfoGetIPAddressByID(id MachineID) (net.IP, error) {
}

func (o *Orchestrator) InfoGetIPAddressByName(name string) (net.IP, error) {
id, ok := o.machineNames[name]
var id MachineID
ok := false

for m, i := range o.machineNames {
if strings.EqualFold(m, name) {
id = i
ok = true
}
}

if !ok {
return net.IP{}, errors.Errorf("machine with name %s not found", name)
Expand Down

0 comments on commit a79fdc4

Please sign in to comment.