diff --git a/communicator.go b/communicator.go index 8419ded..04b29ec 100644 --- a/communicator.go +++ b/communicator.go @@ -20,12 +20,25 @@ 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 (c *communicator) start() { go func() { for e := range c.Queue { go func(event *events.Event) { m := event.Data.(events.URLMaker) 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)) // todo timeout,error diff --git a/events/event_port.go b/events/event_port.go index d91a4e8..af3e466 100644 --- a/events/event_port.go +++ b/events/event_port.go @@ -17,6 +17,7 @@ func (i PortStartEvent) GetUrl() string { func NewPortStartEvent(zone int64, host int64, portCount uint16, t string) *PortStartEvent { return &PortStartEvent{ Zone: zone, + Host: host, PortCount: portCount, Type: t, }