ing
This commit is contained in:
7
central/api/module/crawler.go
Normal file
7
central/api/module/crawler.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package module
|
||||
|
||||
const (
|
||||
CrawlerService_Install = "CrawlerService.install"
|
||||
CrawlerService_Uninstall = "CrawlerService.uninstall"
|
||||
CrawlerService_Update = "CrawlerService.update"
|
||||
)
|
||||
6
central/api/module/discovery.go
Normal file
6
central/api/module/discovery.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package module
|
||||
|
||||
const (
|
||||
DiscoveryService_Start = "DiscoveryService.start"
|
||||
DiscoveryService_Stop = "DiscoveryService.stop"
|
||||
)
|
||||
5
central/api/module/log.go
Normal file
5
central/api/module/log.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package module
|
||||
|
||||
const (
|
||||
LogService_Send = "LogService.send"
|
||||
)
|
||||
@@ -3,7 +3,14 @@ package module
|
||||
import "time"
|
||||
|
||||
const (
|
||||
ProbeHeader_ProbeKey = "overFlow-Probe-Key"
|
||||
ProbeHeader_ProbeKey = "overFlow-Probe-Key"
|
||||
ProbeHeader_Probe_EncryptionKey = "overFlow-Probe-EncryptionKey"
|
||||
)
|
||||
|
||||
const (
|
||||
ProbeService_Started = "ProbeService.started"
|
||||
ProbeService_Stopped = "ProbeService.stopped"
|
||||
ProbeService_Update = "ProbeService.update"
|
||||
)
|
||||
|
||||
type Probe struct {
|
||||
|
||||
9
central/api/module/sensor.go
Normal file
9
central/api/module/sensor.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package module
|
||||
|
||||
const (
|
||||
SensorService_Start = "SensorService.start"
|
||||
SensorService_Stop = "SensorService.stop"
|
||||
SensorService_Add = "SensorService.add"
|
||||
SensorService_Remove = "SensorService.remove"
|
||||
SensorService_Update = "SensorService.update"
|
||||
)
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"git.loafle.net/commons_go/logging"
|
||||
"git.loafle.net/overflow/overflow_probes/central/client/protocol"
|
||||
"git.loafle.net/overflow/overflow_probes/config"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
@@ -51,7 +52,7 @@ func (c *Call) done() {
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
Dial(url string, header http.Header, readBufSize int, writeBufSize int) (*http.Response, error)
|
||||
Dial(url string, header http.Header) (*http.Response, error)
|
||||
Call(method string, args []string, result interface{}) error
|
||||
Notify(method string, args []string) error
|
||||
OnNotify(cb OnNotifyFunc)
|
||||
@@ -83,13 +84,13 @@ func New() Client {
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *client) Dial(url string, header http.Header, readBufSize int, writeBufSize int) (*http.Response, error) {
|
||||
func (c *client) Dial(url string, header http.Header) (*http.Response, error) {
|
||||
var err error
|
||||
var res *http.Response
|
||||
|
||||
dialer := websocket.Dialer{
|
||||
ReadBufferSize: readBufSize,
|
||||
WriteBufferSize: writeBufSize,
|
||||
ReadBufferSize: config.CFG.Central.ReadBufferSize,
|
||||
WriteBufferSize: config.CFG.Central.WriteBufferSize,
|
||||
}
|
||||
|
||||
if c.conn, res, err = dialer.Dial(url, header); nil != err {
|
||||
|
||||
Reference in New Issue
Block a user