From f13df0ed3c8a6e2abf8396355002628c68dc2cfe Mon Sep 17 00:00:00 2001 From: crusader Date: Sat, 16 Dec 2017 14:49:41 +0900 Subject: [PATCH] ing --- probe/_probe.go | 128 --------------------------------------------- probe/on_notify.go | 55 ------------------- 2 files changed, 183 deletions(-) delete mode 100644 probe/_probe.go delete mode 100644 probe/on_notify.go diff --git a/probe/_probe.go b/probe/_probe.go deleted file mode 100644 index 0a74a6a..0000000 --- a/probe/_probe.go +++ /dev/null @@ -1,128 +0,0 @@ -package probe - -// import ( -// "context" -// "fmt" -// "net/http" - -// "git.loafle.net/commons_go/logging" -// "git.loafle.net/overflow/overflow_probes/central/api/module" -// "git.loafle.net/overflow/overflow_probes/central/client" -// "git.loafle.net/overflow/overflow_probes/commons" -// "git.loafle.net/overflow/overflow_probes/config" -// opuu "git.loafle.net/overflow/overflow_probes/util/url" -// ) - -// const ( -// probeEntryPoint = "/probe" -// fileEntryPoint = "/file" -// metricEntryPoint = "/metric" -// ) - -// type Prober interface { -// commons.Starter -// commons.Shutdowner -// } - -// type probe struct { -// probeEntryURL string -// fileEntryURL string -// metricEntryURL string - -// probeClient client.Client -// fileClient client.Client -// metricClient client.Client - -// shutdown chan bool -// } - -// func New() (Prober, error) { -// p := &probe{ -// shutdown: make(chan bool), -// } - -// var err error - -// if p.probeEntryURL, err = opuu.Join(config.Config.Central.URL, probeEntryPoint); nil != err { -// return nil, err -// } -// if p.fileEntryURL, err = opuu.Join(config.Config.Central.URL, fileEntryPoint); nil != err { -// return nil, err -// } -// if p.metricEntryURL, err = opuu.Join(config.Config.Central.URL, metricEntryPoint); nil != err { -// return nil, err -// } - -// p.probeClient = client.New() -// p.fileClient = client.New() -// p.metricClient = client.New() - -// return p, nil -// } - -// func (p *probe) Start() error { -// if err := p.connectToCentral(); nil != err { -// return err -// } - -// p.listen() - -// return nil -// } - -// func (p *probe) listen() { -// go func() { -// for { -// select { -// case <-p.shutdown: -// break -// } -// } -// }() - -// } - -// func (p *probe) connectToCentral() error { -// var err error -// var res *http.Response -// if res, err = client.ConnectToCentralAsProbe(p.probeClient, p.probeEntryURL); nil != err { -// return err -// } - -// encryptionKey := res.Header.Get(module.ProbeHeader_Probe_EncryptionKey) -// config.EncryptionKey = &encryptionKey - -// p.probeClient.OnNotify(p.onNotify) - -// // if _, err = client.ConnectToCentralAsProbe(p.metricClient, p.metricEntryURL); nil != err { -// // return err -// // } - -// return nil -// } - -// func (p *probe) sendNotifyToCentral(method string, params ...string) { -// if err := p.probeClient.Notify(method, params); nil != err { -// logging.Logger().Error(fmt.Sprintf("Probe notify: %v", err)) -// } -// } - -// func (p *probe) Shutdown(ctx context.Context) error { -// for { -// p.stop(fmt.Errorf("Shutdown")) -// select { -// case <-ctx.Done(): -// return ctx.Err() -// } -// } -// } - -// func (p *probe) stop(err error) { -// defer close(p.shutdown) - -// ctx := context.Background() -// if err := p.probeClient.Shutdown(ctx); nil != err { -// logging.Logger().Error(fmt.Sprintf("Client of Probe: %v", err)) -// } - -// } diff --git a/probe/on_notify.go b/probe/on_notify.go deleted file mode 100644 index 107971d..0000000 --- a/probe/on_notify.go +++ /dev/null @@ -1,55 +0,0 @@ -package probe - -// import ( -// "fmt" - -// "git.loafle.net/commons_go/logging" -// "git.loafle.net/overflow/overflow_probes/central/api/module" -// ) - -// func (p *probe) onNotify(method string, params []string) { -// var err error -// switch method { -// case module.CrawlerService_Install: - -// break -// case module.CrawlerService_Uninstall: - -// break -// case module.CrawlerService_Update: - -// break -// case module.SensorService_Start: - -// break -// case module.SensorService_Stop: - -// break -// case module.SensorService_Add: - -// break -// case module.SensorService_Remove: - -// break -// case module.SensorService_Update: - -// break -// case module.ProbeService_Update: - -// break -// case module.LogService_Send: - -// break -// case module.DiscoveryService_Start: - -// break -// case module.DiscoveryService_Stop: - -// break -// } - -// if nil != err { -// logging.Logger().Error(fmt.Sprintf("Probe notify error: %v", err)) -// } - -// }