mirror of https://github.com/cbeuw/Cloak
Fix nil pointer with ClientInfo
This commit is contained in:
parent
83fb53f0d4
commit
52fac535e3
|
|
@ -218,7 +218,7 @@ var ErrBadClientHello = errors.New("non (or malformed) ClientHello")
|
|||
var ErrNotCloak = errors.New("TLS but non-Cloak ClientHello")
|
||||
var ErrBadProxyMethod = errors.New("invalid proxy method")
|
||||
|
||||
func PrepareConnection(firstPacket []byte, sta *State, conn net.Conn) (info *ClientInfo, finisher func([]byte) error, err error) {
|
||||
func PrepareConnection(firstPacket []byte, sta *State, conn net.Conn) (info ClientInfo, finisher func([]byte) error, err error) {
|
||||
ch, err := parseClientHello(firstPacket)
|
||||
if err != nil {
|
||||
log.Debug(err)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var ErrInvalidPubKey = errors.New("public key has invalid format")
|
|||
var ErrCiphertextLength = errors.New("ciphertext has the wrong length")
|
||||
var ErrTimestampOutOfWindow = errors.New("timestamp is outside of the accepting window")
|
||||
|
||||
func TouchStone(ch *ClientHello, sta *State) (info *ClientInfo, sharedSecret []byte, err error) {
|
||||
func TouchStone(ch *ClientHello, sta *State) (info ClientInfo, sharedSecret []byte, err error) {
|
||||
|
||||
if sta.registerRandom(ch.random) {
|
||||
err = ErrReplay
|
||||
|
|
@ -54,7 +54,7 @@ func TouchStone(ch *ClientHello, sta *State) (info *ClientInfo, sharedSecret []b
|
|||
return
|
||||
}
|
||||
|
||||
info = &ClientInfo{
|
||||
info = ClientInfo{
|
||||
UID: plaintext[0:16],
|
||||
SessionId: 0,
|
||||
ProxyMethod: string(bytes.Trim(plaintext[16:28], "\x00")),
|
||||
|
|
|
|||
Loading…
Reference in New Issue