add traffic reset for stats

This commit is contained in:
ginuerzh
2024-12-24 20:11:22 +08:00
parent 914a4622fd
commit 06d993023f
41 changed files with 407 additions and 143 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ package recorder
import (
"context"
"encoding/json"
"errors"
"io"
"github.com/go-gost/core/logger"
@@ -56,7 +57,7 @@ func (p *grpcPlugin) Record(ctx context.Context, b []byte, opts ...recorder.Reco
md, _ := json.Marshal(options.Metadata)
_, err := p.client.Record(ctx,
reply, err := p.client.Record(ctx,
&proto.RecordRequest{
Data: b,
Metadata: md,
@@ -65,6 +66,9 @@ func (p *grpcPlugin) Record(ctx context.Context, b []byte, opts ...recorder.Reco
p.log.Error(err)
return err
}
if reply == nil || !reply.Ok {
return errors.New("record failed")
}
return nil
}