.
This commit is contained in:
parent
9763bc4568
commit
fa5772c240
|
@ -17,6 +17,10 @@ func SetRootURL(url string) {
|
|||
_c.RootURL = url
|
||||
}
|
||||
|
||||
func GetRootURL() string {
|
||||
return _c.RootURL
|
||||
}
|
||||
|
||||
func Send(e *events.Event) {
|
||||
_c.addEvent(e)
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ func TestRealSendByGin(t *testing.T) {
|
|||
|
||||
var u events.URLMaker
|
||||
u = e.Data.(events.URLMaker)
|
||||
t.Log(u.GetUrl())
|
||||
t.Log(GetRootURL() + u.GetUrl())
|
||||
req := httptest.NewRequest("POST", u.GetUrl(), bytes.NewReader(data))
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ func (c *communicator) start() {
|
|||
go func(event *events.Event) {
|
||||
m := event.Data.(events.URLMaker)
|
||||
data, _ := json.Marshal(event)
|
||||
r, _ := http.Post(c.RootURL+m.GetUrl(), "application/json", bytes.NewBuffer(data))
|
||||
r, _ := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(data))
|
||||
e.Result <- events.Result{Message: r.Status}
|
||||
}(e)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
COLLECTOR_INSTALL = "/_api/collector/discovery/event/status/install"
|
||||
COLLECTOR_INSTALL = "/_api/collector/event/status/install"
|
||||
|
||||
DISCOVERY_START = "/_api/collector/event/discovery/status/start"
|
||||
DISCOVERY_END = "/_api/collector/event/discovery/status/end"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package events
|
||||
|
||||
import "loafle.com/overflow/collector/discovery/types"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////// Port Event Start
|
||||
type PortStartEvent struct {
|
||||
Zone int64
|
||||
|
@ -42,16 +44,17 @@ func NewPortFoundEvent(zone int64, host int64, port uint16, t string) *PortFound
|
|||
type PortEndEvent struct {
|
||||
Zone int64
|
||||
Host int64
|
||||
// history ???
|
||||
Histories []*types.PortScanHistory
|
||||
}
|
||||
|
||||
func (i PortEndEvent) GetUrl() string {
|
||||
return PORT_START
|
||||
}
|
||||
|
||||
func NewPortEndEvent(zone int64, host int64) *PortEndEvent {
|
||||
func NewPortEndEvent(zone int64, host int64, history []*types.PortScanHistory) *PortEndEvent {
|
||||
return &PortEndEvent{
|
||||
Zone: zone,
|
||||
Host: host,
|
||||
Histories: history,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user