mirror of https://github.com/cbeuw/Cloak
Fix non random GREASE generation
This commit is contained in:
parent
05972863b5
commit
e0e33e12d6
|
|
@ -3,10 +3,9 @@
|
||||||
package client
|
package client
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Chrome struct{}
|
type Chrome struct{}
|
||||||
|
|
@ -14,8 +13,9 @@ type Chrome struct{}
|
||||||
func makeGREASE() []byte {
|
func makeGREASE() []byte {
|
||||||
// see https://tools.ietf.org/html/draft-davidben-tls-grease-01
|
// see https://tools.ietf.org/html/draft-davidben-tls-grease-01
|
||||||
// This is exclusive to Chrome.
|
// This is exclusive to Chrome.
|
||||||
rand.Seed(time.Now().UnixNano())
|
var one [1]byte
|
||||||
sixteenth := rand.Intn(16)
|
rand.Read(one[:])
|
||||||
|
sixteenth := one[0] % 16
|
||||||
monoGREASE := byte(sixteenth*16 + 0xA)
|
monoGREASE := byte(sixteenth*16 + 0xA)
|
||||||
doubleGREASE := []byte{monoGREASE, monoGREASE}
|
doubleGREASE := []byte{monoGREASE, monoGREASE}
|
||||||
return doubleGREASE
|
return doubleGREASE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue