42 lines
970 B
Go
42 lines
970 B
Go
package events
|
|
|
|
const (
|
|
CENTRAL_POLLING = "P"
|
|
CENTRAL_EVENT = "E"
|
|
)
|
|
|
|
const (
|
|
COLLECTOR_INSTALL = "http://localhost:8080/_api/collector/event/status/install"
|
|
|
|
PORT_START = "http://localhost:8080/_api/collector/event/port/status/start"
|
|
PORT_FOUND = "http://localhost:8080/_api/collector/event/port/status/found"
|
|
PORT_END = "http://localhost:8080/_api/collector/event/port/status/end"
|
|
SERVICE_END = "http://localhost:8080/_api/collector/event/service/status/end"
|
|
)
|
|
|
|
type URLMaker interface {
|
|
GetUrl() string
|
|
}
|
|
|
|
type Event struct {
|
|
Collector_id string
|
|
Time Timestamp
|
|
EventType string
|
|
Data interface{}
|
|
Result chan Result `json:"-"`
|
|
}
|
|
|
|
func (e *Event) GetResult() Result {
|
|
return <-e.Result
|
|
}
|
|
|
|
func NewEvent(dataType string, data interface{}) *Event {
|
|
return &Event{
|
|
Collector_id: "", // get this collector identity
|
|
Time: Now(),
|
|
EventType: dataType,
|
|
Data: data,
|
|
Result: make(chan Result),
|
|
}
|
|
}
|