aggiunto il protcollo nell'array degli IP

This commit is contained in:
Michele Fadda 2015-07-21 15:00:46 +02:00
parent 58211e5dae
commit 9c49a04667

View file

@ -14,10 +14,11 @@ import (
) )
const ( const (
_VERSION = "v1.0.3" _VERSION = "v1.0.4"
_tformat = "2006-01-02" _tformat = "2006-01-02"
_24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) _24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59)
_10m = (time.Minute * 10) _10m = (time.Minute * 10)
_15m = (time.Minute * 15)
) )
var ( var (
@ -26,7 +27,7 @@ var (
LogFile: "log/llconsolidate.log", LogFile: "log/llconsolidate.log",
StartDate: time.Now().Add(-24 * time.Hour).Format(_tformat), StartDate: time.Now().Add(-24 * time.Hour).Format(_tformat),
Duration: _24h, Duration: _24h,
Interval: _10m, Interval: _15m,
} }
) )
@ -60,8 +61,9 @@ type LastLoginDay struct {
} }
type IPs struct { type IPs struct {
IP string `json:"ip"` IP string `json:"ip"`
Date time.Time `json:"date"` Date time.Time `json:"date"`
Protocol string `json:"protocol"`
} }
type Protocols struct { type Protocols struct {
@ -199,7 +201,7 @@ func main() {
if result.IP == lastip.IP && result.Date.Sub(lastip.Date) < opts.Interval { if result.IP == lastip.IP && result.Date.Sub(lastip.Date) < opts.Interval {
//fmt.Println("IPs: ", result.IP, result.Date, result.Date.Sub(lastip.Date)) //fmt.Println("IPs: ", result.IP, result.Date, result.Date.Sub(lastip.Date))
} else { } else {
ips = append(ips, IPs{IP: result.IP, Date: result.Date}) ips = append(ips, IPs{IP: result.IP, Date: result.Date, Protocol: result.Protocol})
lastip.Date = result.Date lastip.Date = result.Date
lastip.IP = result.IP lastip.IP = result.IP
} }