.
This commit is contained in:
parent
2d5cff9c0f
commit
8dfa6f9c0c
|
@ -2,6 +2,7 @@ package communicate
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"loafle.com/commons/communicate/events"
|
||||
"net/http"
|
||||
|
@ -20,14 +21,13 @@ func (c *communicator) addEvent(e *events.Event) {
|
|||
c.Queue <- e
|
||||
}
|
||||
|
||||
//
|
||||
//func CompressDataGzip(data []byte) []byte {
|
||||
// var b bytes.Buffer
|
||||
// w := gzip.NewWriter(&b)
|
||||
// w.Write(data)
|
||||
// w.Close()
|
||||
// return b.Bytes()
|
||||
//}
|
||||
func CompressDataGzip(data []byte) []byte {
|
||||
var b bytes.Buffer
|
||||
w := gzip.NewWriter(&b)
|
||||
w.Write(data)
|
||||
w.Close()
|
||||
return b.Bytes()
|
||||
}
|
||||
|
||||
func (c *communicator) start() {
|
||||
go func() {
|
||||
|
@ -37,9 +37,8 @@ func (c *communicator) start() {
|
|||
data, _ := json.Marshal(event)
|
||||
|
||||
// compress , accept-encoding : gzip
|
||||
|
||||
//res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(CompressDataGzip(data)))
|
||||
res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(data))
|
||||
res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(CompressDataGzip(data)))
|
||||
//res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(data))
|
||||
|
||||
// todo timeout,error
|
||||
if err != nil {
|
||||
|
|
|
@ -53,7 +53,7 @@ type PortEndEvent struct {
|
|||
}
|
||||
|
||||
func (i PortEndEvent) GetUrl() string {
|
||||
return PORT_START
|
||||
return PORT_END
|
||||
}
|
||||
|
||||
func NewPortEndEvent(zone int64, host int64, history []*types.PortScanHistory, t string) *PortEndEvent {
|
||||
|
|
Loading…
Reference in New Issue
Block a user