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