diff --git a/auth/service/NoAuthProbeService.go b/auth/service/NoAuthProbeService.go index 6fd283c..f54feb7 100644 --- a/auth/service/NoAuthProbeService.go +++ b/auth/service/NoAuthProbeService.go @@ -9,8 +9,6 @@ import ( cc "git.loafle.net/commons_go/config" ooccn "git.loafle.net/overflow/overflow_commons_go/config/noauthprobe" oocmn "git.loafle.net/overflow/overflow_commons_go/modules/noauthprobe" - noauthprobeM "git.loafle.net/overflow/overflow_commons_go/modules/noauthprobe/model" - probeM "git.loafle.net/overflow/overflow_commons_go/modules/probe/model" oopai "git.loafle.net/overflow/overflow_probes/auth/info" "git.loafle.net/overflow/overflow_probes/config" ) @@ -22,26 +20,31 @@ type NoAuthProbeService struct { Config ooccn.NoAuthProbeConfig } -func (s *NoAuthProbeService) Accept(probe *probeM.Probe) { - config.Config.Probe.Key = &probe.ProbeKey +func (s *NoAuthProbeService) Accept(probeKey string) error { + config.Config.Probe.Key = &probeKey if err := cc.Save(*config.Config, *config.ConfigFilePath, true); nil != err { s.DoneChan <- fmt.Errorf("Auth: Saving of config file[%s] failed error[%v]", *config.ConfigFilePath, err) - return + return nil } + logging.Logger().Info(fmt.Sprintf("Auth: Probe[%s] has been accepted from central", probeKey)) s.DoneChan <- nil + + return nil } -func (s *NoAuthProbeService) Deny(noAuthProbe *noauthprobeM.NoAuthProbe) { +func (s *NoAuthProbeService) Deny() error { n := time.Now() s.Config.DenyDate = &n if err := cc.Save(s.Config, s.ConfigPath, true); nil != err { s.DoneChan <- fmt.Errorf("Auth: Saving of NoAuth config file[%s] failed error[%v]", s.ConfigPath, err) - return + return nil } + logging.Logger().Info(fmt.Sprintf("Auth: Probe has been denyed from central")) s.DoneChan <- nil + return nil } func (s *NoAuthProbeService) GetRequestHeader() map[string][]string { @@ -53,7 +56,7 @@ func (s *NoAuthProbeService) GetRequestHeader() map[string][]string { case ooccn.NoAuthProbeStateTypeRegisterd: header[oocmn.HTTPRequestHeaderKey_NoAuthProbe_Method] = []string{oocmn.HTTPRequestHeaderValue_NoAuthProbe_Method_Connect} - header[oocmn.HTTPRequestHeaderKey_NoAuthProbe_TempProbeKey] = []string{oocmn.HTTPRequestHeaderValue_NoAuthProbe_Method_Connect} + header[oocmn.HTTPRequestHeaderKey_NoAuthProbe_TempProbeKey] = []string{*s.Config.TempKey} } return header diff --git a/client/central/data/socket_builders.go b/client/central/data/socket_builders.go index b16dc44..334d2ce 100644 --- a/client/central/data/socket_builders.go +++ b/client/central/data/socket_builders.go @@ -8,7 +8,7 @@ import ( func newSocketBuilder() cwfc.SocketBuilder { sb := &SocketBuilders{} - sb.SocketBuilders = oopcc.NewSocketBuilder(oocmp.HTTPEntry_Probe) + sb.SocketBuilders = oopcc.NewSocketBuilder(oocmp.HTTPEntry_Data) if nil == sb.SocketBuilders { return nil } diff --git a/client/central/data/socket_handlers.go b/client/central/data/socket_handlers.go index 16f3937..25a1d9d 100644 --- a/client/central/data/socket_handlers.go +++ b/client/central/data/socket_handlers.go @@ -18,7 +18,7 @@ func (sh *SocketHandlers) OnConnect(socketContext cwfc.SocketContext, res *http. } func (sh *SocketHandlers) OnDisconnect(soc cwfc.Socket) { - logging.Logger().Info(fmt.Sprintf("Auth: client has been disconnected soc[%v]", soc)) + logging.Logger().Info(fmt.Sprintf("Probe: client has been disconnected soc[%v]", soc)) } diff --git a/client/central/probe/socket_handlers.go b/client/central/probe/socket_handlers.go index ccce033..01be22c 100644 --- a/client/central/probe/socket_handlers.go +++ b/client/central/probe/socket_handlers.go @@ -22,7 +22,7 @@ func (sh *SocketHandlers) OnConnect(socketContext cwfc.SocketContext, res *http. } func (sh *SocketHandlers) OnDisconnect(soc cwfc.Socket) { - logging.Logger().Info(fmt.Sprintf("Auth: client has been disconnected soc[%v]", soc)) + logging.Logger().Info(fmt.Sprintf("Probe: client has been disconnected soc[%v]", soc)) } diff --git a/client/central/socket_builders.go b/client/central/socket_builders.go index 1d753f2..32bee26 100644 --- a/client/central/socket_builders.go +++ b/client/central/socket_builders.go @@ -10,7 +10,7 @@ import ( func NewSocketBuilder(entryPath string) *SocketBuilders { sb := &SocketBuilders{} - sb.SocketBuilders = oopccc.NewSocketBuilder(oocmp.HTTPEntry_Probe) + sb.SocketBuilders = oopccc.NewSocketBuilder(entryPath) if nil == sb.SocketBuilders { return nil } diff --git a/config.json b/config.json index 2c5b959..30fbdf7 100644 --- a/config.json +++ b/config.json @@ -5,10 +5,13 @@ "readBufferSize": 8192, "writeBufferSize": 8192 }, + "probe": { + "key": "95d8bcdc739741dca74c4a0e489e0774" + }, "paths": { - "root": "", "bin": "bin", "config": "config", - "pid": "pid" + "pid": "pid", + "root": "" } -} +} \ No newline at end of file diff --git a/noauthprobe.json b/noauthprobe.json new file mode 100644 index 0000000..e049b0f --- /dev/null +++ b/noauthprobe.json @@ -0,0 +1,3 @@ +{ + "tempKey": "969946e1-4de3-486a-b11c-00d311244c3a" +} \ No newline at end of file