@@ -161,9 +161,6 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {
161161 }
162162 NConfig .LengthMin = uint64 (min )
163163 NConfig .LengthMax = uint64 (max )
164- if NConfig .LengthMin > NConfig .LengthMax {
165- NConfig .LengthMin , NConfig .LengthMax = NConfig .LengthMax , NConfig .LengthMin
166- }
167164 if NConfig .LengthMin == 0 {
168165 return nil , errors .New ("rand lengthMin or lengthMax cannot be 0" )
169166 }
@@ -180,23 +177,12 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {
180177 }
181178
182179 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" )
184181 }
185182
186183 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 )
200186 }
201187 return NConfig , nil
202188}
0 commit comments