@@ -38,17 +38,12 @@ type job struct {
3838}
3939
4040type job4Marshal struct {
41- Type string `json:"type"`
42- Status string `json:"status"`
43- StartTime string `json:"start_time"`
44- EndTime string `json:"end_time,omitempty"`
45- Duration string `json:"duration,omitempty"`
46- Output string `json:"output,omitempty"`
47- Input string `json:"input,omitempty"`
48- Username string `json:"username,omitempty"`
49- Speed float64 `json:"speed,omitempty"`
50- Progress string `json:"progress"`
51- Err string `json:"error,omitempty"`
41+ Type string `json:"type"`
42+ Status string `json:"status"`
43+ StartTime string `json:"start_time"`
44+ EndTime string `json:"end_time,omitempty"`
45+ Progress string `json:"progress"`
46+ Err string `json:"error,omitempty"`
5247}
5348
5449func (job * job ) IsRunning () bool {
@@ -90,16 +85,29 @@ type captureJob struct {
9085 cfg capture.CaptureConfig
9186}
9287
88+ type captureJob4Marshal struct {
89+ job4Marshal
90+ Output string `json:"output,omitempty"`
91+ Duration string `json:"duration,omitempty"`
92+ Compress bool `json:"compress,omitempty"`
93+ EncryptionMethod string `json:"encryption-method,omitempty"`
94+ }
95+
9396func (job * captureJob ) Type () JobType {
9497 return Capture
9598}
9699
97100func (job * captureJob ) MarshalJSON () ([]byte , error ) {
98101 job4Marshal := job .getJob4Marshal ()
99102 job4Marshal .Type = "capture"
100- job4Marshal .Output = ast .RedactURL (job .cfg .Output )
101- job4Marshal .Duration = job .cfg .Duration .String ()
102- return json .Marshal (job4Marshal )
103+ c := captureJob4Marshal {
104+ job4Marshal : * job4Marshal ,
105+ Output : ast .RedactURL (job .cfg .Output ),
106+ Duration : job .cfg .Duration .String (),
107+ Compress : job .cfg .Compress ,
108+ EncryptionMethod : job .cfg .EncryptionMethod ,
109+ }
110+ return json .Marshal (c )
103111}
104112
105113func (job * captureJob ) String () string {
@@ -117,20 +125,29 @@ type replayJob struct {
117125 cfg replay.ReplayConfig
118126}
119127
128+ type replayJob4Marshal struct {
129+ job4Marshal
130+ Input string `json:"input,omitempty"`
131+ Username string `json:"username,omitempty"`
132+ Speed float64 `json:"speed,omitempty"`
133+ ReadOnly bool `json:"readonly,omitempty"`
134+ }
135+
120136func (job * replayJob ) Type () JobType {
121137 return Replay
122138}
123139
124140func (job * replayJob ) MarshalJSON () ([]byte , error ) {
125141 job4Marshal := job .getJob4Marshal ()
126142 job4Marshal .Type = "replay"
127- job4Marshal .Input = ast .RedactURL (job .cfg .Input )
128- job4Marshal .Username = job .cfg .Username
129- job4Marshal .Speed = job .cfg .Speed
130- if job4Marshal .Speed == 0 {
131- job4Marshal .Speed = 1
143+ r := replayJob4Marshal {
144+ job4Marshal : * job4Marshal ,
145+ Input : ast .RedactURL (job .cfg .Input ),
146+ Username : job .cfg .Username ,
147+ Speed : job .cfg .Speed ,
148+ ReadOnly : job .cfg .ReadOnly ,
132149 }
133- return json .Marshal (job4Marshal )
150+ return json .Marshal (r )
134151}
135152
136153func (job * replayJob ) String () string {
0 commit comments