From 43ed2ea4385fc5e29f0ac505405d29a63b58e8b4 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Mon, 14 Jan 2019 12:31:46 -0600 Subject: [PATCH] Various changes. --- pkg/model/model.go | 4 +++- pkg/resolver/resolver.go | 2 +- pkg/shell/shell.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/model/model.go b/pkg/model/model.go index eb1a77f..bee0fed 100644 --- a/pkg/model/model.go +++ b/pkg/model/model.go @@ -1,11 +1,13 @@ package model +// Results is for DNS results type Results struct { IP string `json:"ip"` Hostname string `json:"hostname"` - TXT string `json:"TXT` + TXT string `json:"TXT"` } +// UniqResults is for Unique DNS Results type UniqResults struct { IP string `json:"ip"` Hostname string `json:"hostname"` diff --git a/pkg/resolver/resolver.go b/pkg/resolver/resolver.go index 5393ff2..460a6bc 100644 --- a/pkg/resolver/resolver.go +++ b/pkg/resolver/resolver.go @@ -28,6 +28,7 @@ func lookupName(fqdn, serverAddr string) (string, error) { return "", errors.New("no A record returned") } +// PerformZoneTransfer performs zone transfers and gathers a list from config.Domains func PerformZoneTransfer(config config.Config) []string { data := make([]string, 0) @@ -46,7 +47,6 @@ func PerformZoneTransfer(config config.Config) []string { var ip, hostname, txt string switch v := a.(type) { case *dns.TXT: - txt = string(v.Txt[0]) hostname = v.Hdr.Name cip, err := lookupName(strings.TrimRight(v.Hdr.Name, "."), server) if err != nil || cip == "" { diff --git a/pkg/shell/shell.go b/pkg/shell/shell.go index 3ea295d..0d70bab 100644 --- a/pkg/shell/shell.go +++ b/pkg/shell/shell.go @@ -7,6 +7,7 @@ import ( "git.linuxrocker.com/mattburchett/go_tab-magic/pkg/config" ) +// CreateShellAliases will create shell aliases and fmt.Println them func CreateShellAliases(data []string, username string, config config.Config) { for _, i := range data { splitStrings := strings.Split(i, " ") @@ -40,7 +41,7 @@ func CreateShellAliases(data []string, username string, config config.Config) { for _, i := range txtSplit { if strings.Contains(i, "SSH_PORT") { - port := strings.TrimLeft(i, "SSH_PORT=") + port := strings.TrimPrefix(i, "SSH_PORT=") racOpts = fmt.Sprintf("-AXt -p %v -l", port) } else if strings.Contains(i, "OS_FAMILY") { osFamily := strings.Split(i, "=") @@ -58,7 +59,7 @@ func CreateShellAliases(data []string, username string, config config.Config) { sudo = "" } } else if strings.Contains(i, "REMOTE_USER") { - user := strings.TrimLeft(i, "REMOTE_USER=") + user := strings.TrimPrefix(i, "REMOTE_USER=") remoteUser = user } }