@@ -161,9 +161,6 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {
161
161
}
162
162
NConfig .LengthMin = uint64 (min )
163
163
NConfig .LengthMax = uint64 (max )
164
- if NConfig .LengthMin > NConfig .LengthMax {
165
- NConfig .LengthMin , NConfig .LengthMax = NConfig .LengthMax , NConfig .LengthMin
166
- }
167
164
if NConfig .LengthMin == 0 {
168
165
return nil , errors .New ("rand lengthMin or lengthMax cannot be 0" )
169
166
}
@@ -180,23 +177,12 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {
180
177
}
181
178
182
179
default :
183
- return nil , errors .New ("Invalid packet,only rand, str, base64 are supported" )
180
+ return nil , errors .New ("Invalid packet, only rand/ str/ base64 are supported" )
184
181
}
185
182
186
183
if noise .Delay != nil {
187
- if noise .Delay .From != 0 && noise .Delay .To != 0 {
188
- NConfig .DelayMin = uint64 (noise .Delay .From )
189
- NConfig .DelayMax = uint64 (noise .Delay .To )
190
- if NConfig .DelayMin > NConfig .LengthMax {
191
- NConfig .DelayMin , NConfig .DelayMax = NConfig .LengthMax , NConfig .DelayMin
192
- }
193
- } else {
194
- return nil , errors .New ("DelayMin or DelayMax cannot be zero" )
195
- }
196
-
197
- } else {
198
- NConfig .DelayMin = 0
199
- NConfig .DelayMax = 0
184
+ NConfig .DelayMin = uint64 (noise .Delay .From )
185
+ NConfig .DelayMax = uint64 (noise .Delay .To )
200
186
}
201
187
return NConfig , nil
202
188
}
0 commit comments