diff --git a/glide.yaml b/glide.yaml index bea7d17..e38b6ec 100644 --- a/glide.yaml +++ b/glide.yaml @@ -2,3 +2,4 @@ package: git.loafle.net/overflow/probe_gateway_rpc import: - package: git.loafle.net/commons/server-go - package: git.loafle.net/commons/configuration-go +- package: git.loafle.net/overflow/external-go diff --git a/server/server-handler.go b/server/server-handler.go index 4212858..0cd765b 100644 --- a/server/server-handler.go +++ b/server/server-handler.go @@ -2,7 +2,7 @@ package server import ( cs "git.loafle.net/commons/server-go" - oge "git.loafle.net/overflow/gateway/external" + oe "git.loafle.net/overflow/external-go" ogrs "git.loafle.net/overflow/gateway_rpc/server" "git.loafle.net/overflow/probe_gateway_rpc/config" "git.loafle.net/overflow/probe_gateway_rpc/subscribe" @@ -22,7 +22,7 @@ func (sh *ServerHandlers) Init(serverCtx cs.ServerCtx) error { if err := sh.ServerHandlers.Init(serverCtx); nil != err { return err } - oge.InitPackage(sh.Config.External) + oe.InitPackage(sh.Config.External) subscribe.InitPackage() return nil @@ -33,7 +33,7 @@ func (sh *ServerHandlers) OnStart(serverCtx cs.ServerCtx) error { return err } - oge.StartPackage(sh.Config.External) + oe.StartPackage(sh.Config.External) subscribe.StartPackage() return nil @@ -41,14 +41,14 @@ func (sh *ServerHandlers) OnStart(serverCtx cs.ServerCtx) error { func (sh *ServerHandlers) OnStop(serverCtx cs.ServerCtx) { subscribe.StopPackage() - oge.StopPackage(sh.Config.External) + oe.StopPackage(sh.Config.External) sh.ServerHandlers.OnStop(serverCtx) } func (sh *ServerHandlers) Destroy(serverCtx cs.ServerCtx) { subscribe.DestroyPackage() - oge.DestroyPackage(sh.Config.External) + oe.DestroyPackage(sh.Config.External) sh.ServerHandlers.Destroy(serverCtx) } diff --git a/servlet/auth-servlet.go b/servlet/auth-servlet.go index 78dd06c..ef50a4e 100644 --- a/servlet/auth-servlet.go +++ b/servlet/auth-servlet.go @@ -14,11 +14,12 @@ import ( occn "git.loafle.net/overflow/commons-go/config/noauthprobe" ocmm "git.loafle.net/overflow/commons-go/model/meta" ocmn "git.loafle.net/overflow/commons-go/model/noauthprobe" + oe "git.loafle.net/overflow/external-go" + oeg "git.loafle.net/overflow/external-go/grpc" og "git.loafle.net/overflow/gateway" - "git.loafle.net/overflow/gateway/external/grpc" ogs "git.loafle.net/overflow/gateway/subscribe" ogrs "git.loafle.net/overflow/gateway_rpc/servlet" - "git.loafle.net/overflow/probe_gateway_rpc/subscribe" + opgrs "git.loafle.net/overflow/probe_gateway_rpc/subscribe" ) type AuthServlet interface { @@ -42,7 +43,7 @@ func (s *AuthServlets) OnStart(serverCtx server.ServerCtx) error { return err } - subscribeChan, err := subscribe.Subscriber.Subscribe(occn.HTTPEntry_Auth) + subscribeChan, err := opgrs.Subscriber.Subscribe(occn.HTTPEntry_Auth) if nil != err { return err } @@ -52,7 +53,7 @@ func (s *AuthServlets) OnStart(serverCtx server.ServerCtx) error { } func (s *AuthServlets) OnStop(serverCtx server.ServerCtx) { - if err := subscribe.Subscriber.Unsubscribe(occn.HTTPEntry_Auth); nil != err { + if err := opgrs.Subscriber.Unsubscribe(occn.HTTPEntry_Auth); nil != err { logging.Logger().Warn(err) } @@ -85,7 +86,7 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req return nil, fmt.Errorf("Base64 Encoding Error: %s", err.Error()) } grpcCTX := context.Background() - r, err := grpc.Exec(grpcCTX, "NoAuthProbeService.regist", string(rJSON)) + r, err := oeg.Exec(grpcCTX, "NoAuthProbeService.regist", string(rJSON)) if nil != err { return nil, fmt.Errorf("grpc call Error: %s", err.Error()) } @@ -101,7 +102,7 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req extHeader.Add(occn.HTTPResponseHeaderKey_NoAuthProbe_Method_Param, nap.TempProbeKey) servletCtx.SetAttribute(og.SessionIDKey, nap.TempProbeKey) - servletCtx.SetAttribute(og.SessionClientTypeKey, og.PROBE) + servletCtx.SetAttribute(og.SessionClientTypeKey, oe.PROBE) servletCtx.SetAttribute(og.SessionTargetIDKey, nap.TempProbeKey) return extHeader, nil @@ -113,7 +114,7 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req tempProbeKey := string(bTempProbeKey) grpcCTX := context.Background() - r, err := grpc.Exec(grpcCTX, "NoAuthProbeService.readByTempProbeKey", tempProbeKey) + r, err := oeg.Exec(grpcCTX, "NoAuthProbeService.readByTempProbeKey", tempProbeKey) if nil != err { return nil, fmt.Errorf("grpc result error: %s", err.Error()) } @@ -139,7 +140,7 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req } servletCtx.SetAttribute(og.SessionIDKey, tempProbeKey) - servletCtx.SetAttribute(og.SessionClientTypeKey, og.PROBE) + servletCtx.SetAttribute(og.SessionClientTypeKey, oe.PROBE) servletCtx.SetAttribute(og.SessionTargetIDKey, tempProbeKey) return extHeader, nil @@ -155,7 +156,7 @@ func (s *AuthServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) _tempProbeKey := servletCtx.GetAttribute(og.SessionIDKey) if nil != _tempProbeKey { grpcCTX := context.Background() - _, err := grpc.Exec(grpcCTX, "NoAuthProbeService.onConnect", _tempProbeKey.(string), conn.RemoteAddr().String()) + _, err := oeg.Exec(grpcCTX, "NoAuthProbeService.onConnect", _tempProbeKey.(string), conn.RemoteAddr().String()) if nil != err { logging.Logger().Errorf("onConnect error %v", err) } @@ -168,7 +169,7 @@ func (s *AuthServlets) OnDisconnect(servletCtx server.ServletCtx) { _tempProbeKey := servletCtx.GetAttribute(og.SessionIDKey) if nil != _tempProbeKey { grpcCTX := context.Background() - _, err := grpc.Exec(grpcCTX, "NoAuthProbeService.onDisconnect", _tempProbeKey.(string)) + _, err := oeg.Exec(grpcCTX, "NoAuthProbeService.onDisconnect", _tempProbeKey.(string)) if nil != err { logging.Logger().Errorf("onDisconnect error %v", err) } diff --git a/servlet/probe-servlet.go b/servlet/probe-servlet.go index 3003f2f..42177e0 100644 --- a/servlet/probe-servlet.go +++ b/servlet/probe-servlet.go @@ -12,11 +12,12 @@ import ( "git.loafle.net/commons/server-go/socket" occp "git.loafle.net/overflow/commons-go/config/probe" ocmp "git.loafle.net/overflow/commons-go/model/probe" + oe "git.loafle.net/overflow/external-go" + oeg "git.loafle.net/overflow/external-go/grpc" og "git.loafle.net/overflow/gateway" - "git.loafle.net/overflow/gateway/external/grpc" ogs "git.loafle.net/overflow/gateway/subscribe" ogrs "git.loafle.net/overflow/gateway_rpc/servlet" - "git.loafle.net/overflow/probe_gateway_rpc/subscribe" + opgrs "git.loafle.net/overflow/probe_gateway_rpc/subscribe" ) type ProbeServlet interface { @@ -40,7 +41,7 @@ func (s *ProbeServlets) OnStart(serverCtx server.ServerCtx) error { return err } - subscribeChan, err := subscribe.Subscriber.Subscribe(occp.HTTPEntry_Probe) + subscribeChan, err := opgrs.Subscriber.Subscribe(occp.HTTPEntry_Probe) if nil != err { return err } @@ -50,7 +51,7 @@ func (s *ProbeServlets) OnStart(serverCtx server.ServerCtx) error { } func (s *ProbeServlets) OnStop(serverCtx server.ServerCtx) { - if err := subscribe.Subscriber.Unsubscribe(occp.HTTPEntry_Probe); nil != err { + if err := opgrs.Subscriber.Unsubscribe(occp.HTTPEntry_Probe); nil != err { logging.Logger().Warn(err) } @@ -84,7 +85,7 @@ func (s *ProbeServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Re probeKey := string(bProbeKey) grpcCTX := context.Background() - r, err := grpc.Exec(grpcCTX, "ProbeService.readByProbeKey", probeKey) + r, err := oeg.Exec(grpcCTX, "ProbeService.readByProbeKey", probeKey) if nil != err { return nil, fmt.Errorf("grpc call Error: %s", err.Error()) } @@ -100,7 +101,7 @@ func (s *ProbeServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Re extHeader.Add(occp.HTTPResponseHeaderKey_Probe_Method_Param, probe.EncryptionKey) servletCtx.SetAttribute(og.SessionIDKey, probeKey) - servletCtx.SetAttribute(og.SessionClientTypeKey, og.PROBE) + servletCtx.SetAttribute(og.SessionClientTypeKey, oe.PROBE) servletCtx.SetAttribute(og.SessionTargetIDKey, probeKey) return extHeader, nil @@ -112,7 +113,7 @@ func (s *ProbeServlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn _probeKey := servletCtx.GetAttribute(og.SessionIDKey) if nil != _probeKey { grpcCTX := context.Background() - _, err := grpc.Exec(grpcCTX, "ProbeService.onConnect", _probeKey.(string), conn.RemoteAddr().String()) + _, err := oeg.Exec(grpcCTX, "ProbeService.onConnect", _probeKey.(string), conn.RemoteAddr().String()) if nil != err { logging.Logger().Errorf("onConnect error %v", err) } @@ -125,7 +126,7 @@ func (s *ProbeServlets) OnDisconnect(servletCtx server.ServletCtx) { _probeKey := servletCtx.GetAttribute(og.SessionIDKey) if nil != _probeKey { grpcCTX := context.Background() - _, err := grpc.Exec(grpcCTX, "ProbeService.onDisconnect", _probeKey.(string)) + _, err := oeg.Exec(grpcCTX, "ProbeService.onDisconnect", _probeKey.(string)) if nil != err { logging.Logger().Errorf("onDisconnect error %v", err) } diff --git a/subscribe/subscribe.go b/subscribe/subscribe.go index 1ea2ed8..91044bd 100644 --- a/subscribe/subscribe.go +++ b/subscribe/subscribe.go @@ -2,7 +2,7 @@ package subscribe import ( "git.loafle.net/commons/logging-go" - oger "git.loafle.net/overflow/gateway/external/redis" + oer "git.loafle.net/overflow/external-go/redis" ogsr "git.loafle.net/overflow/gateway/subscribe/redis" ) @@ -10,7 +10,7 @@ var Subscriber *ogsr.Subscribers func InitPackage() { Subscriber = &ogsr.Subscribers{} - Subscriber.Conn = oger.Pool.Get() + Subscriber.Conn = oer.Pool.Get() if err := Subscriber.Start(); nil != err { logging.Logger().Panic(err) }