|
|
|
@ -127,7 +127,7 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
|
|
|
|
|
hello.SessionId[2] = core.Version_z |
|
|
|
|
copy(hello.SessionId[8:], config.ShortId) |
|
|
|
|
if config.Show { |
|
|
|
|
fmt.Printf("REALITY localAddr: %v\thello.sessionId[:16]: %v\n", localAddr, hello.SessionId[:16]) |
|
|
|
|
fmt.Printf("REALITY localAddr: %v\thello.SessionId[:16]: %v\n", localAddr, hello.SessionId[:16]) |
|
|
|
|
} |
|
|
|
|
uConn.AuthKey = uConn.HandshakeState.State13.EcdheParams.SharedKey(config.PublicKey) |
|
|
|
|
if uConn.AuthKey == nil { |
|
|
|
@ -136,14 +136,13 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
|
|
|
|
|
if _, err := hkdf.New(sha256.New, uConn.AuthKey, hello.Random[:20], []byte("REALITY")).Read(uConn.AuthKey); err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
if config.Show { |
|
|
|
|
fmt.Printf("REALITY localAddr: %v\tuConn.AuthKey[:16]: %v\n", localAddr, uConn.AuthKey[:16]) |
|
|
|
|
} |
|
|
|
|
block, _ := aes.NewCipher(uConn.AuthKey) |
|
|
|
|
aead, _ := cipher.NewGCM(block) |
|
|
|
|
aead.Seal(hello.SessionId[:0], hello.Random[20:], hello.SessionId[:16], hello.Raw) |
|
|
|
|
copy(hello.Raw[39:], hello.SessionId) |
|
|
|
|
if config.Show { |
|
|
|
|
fmt.Printf("REALITY localAddr: %v\thello.sessionId: %v\n", localAddr, hello.SessionId) |
|
|
|
|
fmt.Printf("REALITY localAddr: %v\tuConn.AuthKey: %v\n", localAddr, uConn.AuthKey) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if err := uConn.Handshake(); err != nil { |
|
|
|
|
return nil, err |
|
|
|
|