Skip to content

Commit

Permalink
Freedom noises: Change legacy variable name (#4238)
Browse files Browse the repository at this point in the history
Closes #4237
  • Loading branch information
Fangliding authored Jan 2, 2025
1 parent e80ca67 commit 33186ca
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
4 changes: 2 additions & 2 deletions infra/conf/freedom.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {

case "str":
//user input string
NConfig.StrNoise = []byte(strings.TrimSpace(noise.Packet))
NConfig.Packet = []byte(strings.TrimSpace(noise.Packet))

case "base64":
//user input base64
NConfig.StrNoise, err = base64.StdEncoding.DecodeString(strings.TrimSpace(noise.Packet))
NConfig.Packet, err = base64.StdEncoding.DecodeString(strings.TrimSpace(noise.Packet))
if err != nil {
return nil, errors.New("Invalid base64 string")
}
Expand Down
92 changes: 46 additions & 46 deletions proxy/freedom/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proxy/freedom/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ message Noise {
uint64 length_max = 2;
uint64 delay_min = 3;
uint64 delay_max = 4;
bytes str_noise = 5;
bytes packet = 5;
}

message Config {
Expand Down
4 changes: 2 additions & 2 deletions proxy/freedom/freedom.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ func (w *NoisePacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
var err error
for _, n := range w.noises {
//User input string or base64 encoded string
if n.StrNoise != nil {
noise = n.StrNoise
if n.Packet != nil {
noise = n.Packet
} else {
//Random noise
noise, err = GenerateRandomBytes(randBetween(int64(n.LengthMin),
Expand Down

0 comments on commit 33186ca

Please sign in to comment.