Add obfuscated2 server handshake

This commit is contained in:
9seconds
2021-03-23 10:27:22 +03:00
parent f7c33ee333
commit 66c45dc83b
6 changed files with 123 additions and 99 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ type Conn struct {
writeBuf []byte
}
func (c Conn) Read(p []byte) (int, error) {
func (c *Conn) Read(p []byte) (int, error) {
n, err := c.Conn.Read(p)
if err != nil {
return n, err // nolint: wrapcheck
@@ -25,9 +25,9 @@ func (c Conn) Read(p []byte) (int, error) {
return n, nil
}
func (c Conn) Write(p []byte) (int, error) {
func (c *Conn) Write(p []byte) (int, error) {
c.writeBuf = append(c.writeBuf[:0], p...)
c.Encryptor.XORKeyStream(c.writeBuf, c.writeBuf)
c.Encryptor.XORKeyStream(c.writeBuf, p)
return c.Conn.Write(c.writeBuf)
}