Skip to content

Commit

Permalink
Merge branch 'XTLS:main' into add_hex_to_udp_noise
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Jan 2, 2025
2 parents 8d08d66 + 33186ca commit a00cdac
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 @@ -168,7 +168,7 @@ 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 "hex":
// user input hex - Decode hex string into byte slice
Expand All @@ -179,7 +179,7 @@ func ParseNoise(noise *Noise) (*freedom.Noise, error) {

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 a00cdac

Please sign in to comment.