From 16b602dffa4d36dde8d2fff1a743e27addcc25c5 Mon Sep 17 00:00:00 2001 From: Justin Timperio Date: Thu, 25 Mar 2021 20:35:55 -0400 Subject: [PATCH] Quick update --- gomap.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/gomap.go b/gomap.go index ac310e6..0019718 100644 --- a/gomap.go +++ b/gomap.go @@ -14,6 +14,19 @@ type IPScanResult struct { Results []portResult } +// Contains a slice of of JsonIP results +type JsonRange struct { + results []JsonIP +} + +// Contains the results for a single JSON entry +type JsonIP struct { + IP string + Hostname string + Active bool + Ports []string +} + type portResult struct { Port int State bool @@ -129,19 +142,8 @@ func (results RangeScanResult) String() string { return b.String() } -type jsonRange struct { - results []jsonIP -} - -type jsonIP struct { - IP string - Hostname string - Active bool - Ports []string -} - func (results *IPScanResult) Json() (string, error) { - var ipdata jsonIP + var ipdata JsonIP fmt.Println(results.IP) ipdata.IP = fmt.Sprintf("%s", results.IP[len(results.IP)-1]) ipdata.Hostname = results.Hostname @@ -172,10 +174,10 @@ func (results *IPScanResult) Json() (string, error) { } func (results RangeScanResult) Json() (string, error) { - var data jsonRange + var data JsonRange for _, r := range results { - var ipdata jsonIP + var ipdata JsonIP ipdata.IP = fmt.Sprintf("%s", r.IP[len(r.IP)-1]) ipdata.Hostname = r.Hostname