feat: enforce telemetry-only mode and safe agent decommission lifecycle

This commit is contained in:
Buri
2026-09-04 18:17:52 +08:00
parent 3d2b27f4ec
commit 8c481985c2
8 changed files with 121 additions and 1 deletions
+4
View File
@@ -7,6 +7,7 @@ import (
"github.com/nezhahq/nezha/pkg/grpcx"
pb "github.com/nezhahq/nezha/proto"
"github.com/nezhahq/nezha/service/singleton"
)
func (s *NezhaHandler) IOStream(stream pb.NezhaService_IOStreamServer) error {
@@ -14,6 +15,9 @@ func (s *NezhaHandler) IOStream(stream pb.NezhaService_IOStreamServer) error {
if err != nil {
return err
}
if srv, ok := singleton.ServerShared.Get(clientID); ok && srv != nil && srv.IsTelemetryOnly() {
return fmt.Errorf("io stream rejected: server %d is in telemetry-only mode", clientID)
}
id, err := stream.Recv()
if err != nil {
return err