Skip to content

Commit 26f6030

Browse files
committed
fix: 335d54e sync mistake
1 parent b481eca commit 26f6030

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

transport/vless/encryption/client.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ func (i *ClientInstance) Handshake(conn net.Conn) (net.Conn, error) {
123123
}
124124

125125
if t != 1 {
126-
return nil, fmt.Errorf("unexpected type %v, expect random hello", t)
126+
return nil, fmt.Errorf("unexpected type %v, expect server hello", t)
127127
}
128-
peerRandomHello := make([]byte, 1088+21)
129-
if l != len(peerRandomHello) {
130-
return nil, fmt.Errorf("unexpected length %v for random hello", l)
128+
peerServerHello := make([]byte, 1088+21)
129+
if l != len(peerServerHello) {
130+
return nil, fmt.Errorf("unexpected length %v for server hello", l)
131131
}
132-
if _, err := io.ReadFull(c.Conn, peerRandomHello); err != nil {
132+
if _, err := io.ReadFull(c.Conn, peerServerHello); err != nil {
133133
return nil, err
134134
}
135-
encapsulatedPfsKey := peerRandomHello[:1088]
136-
c.ticket = peerRandomHello[1088:]
135+
encapsulatedPfsKey := peerServerHello[:1088]
136+
c.ticket = peerServerHello[1088:]
137137

138138
pfsKey, err := pfsDKey.Decapsulate(encapsulatedPfsKey)
139139
if err != nil {
@@ -216,17 +216,17 @@ func (c *ClientConn) Read(b []byte) (int, error) {
216216
if t != 0 {
217217
return 0, fmt.Errorf("unexpected type %v, expect server random", t)
218218
}
219-
peerRandom := make([]byte, 32)
220-
if l != len(peerRandom) {
219+
peerRandomHello := make([]byte, 32)
220+
if l != len(peerRandomHello) {
221221
return 0, fmt.Errorf("unexpected length %v for server random", l)
222222
}
223-
if _, err := io.ReadFull(c.Conn, peerRandom); err != nil {
223+
if _, err := io.ReadFull(c.Conn, peerRandomHello); err != nil {
224224
return 0, err
225225
}
226226
if c.random == nil {
227227
return 0, errors.New("empty c.random")
228228
}
229-
c.peerAead = NewAead(ClientCipher, c.baseKey, peerRandom, c.random)
229+
c.peerAead = NewAead(ClientCipher, c.baseKey, peerRandomHello, c.random)
230230
c.peerNonce = make([]byte, 12)
231231
}
232232
if len(c.peerCache) != 0 {

0 commit comments

Comments
 (0)