remove Buffer.Append method

This commit is contained in:
Darien Raymond
2018-04-19 22:56:55 +02:00
parent 1ad429d1d4
commit 1425fd2ba9
17 changed files with 28 additions and 35 deletions

View File

@@ -255,7 +255,7 @@ func writeSocks4Response(writer io.Writer, errCode byte, address net.Address, po
buffer.AppendBytes(0x00, errCode)
common.Must(buffer.AppendSupplier(serial.WriteUint16(port.Value())))
buffer.Append(address.IP())
buffer.Write(address.IP())
_, err := writer.Write(buffer.Bytes())
return err
}
@@ -292,7 +292,7 @@ func EncodeUDPPacket(request *protocol.RequestHeader, data []byte) (*buf.Buffer,
b.Release()
return nil, err
}
b.Append(data)
b.Write(data)
return b, nil
}
@@ -358,9 +358,9 @@ func ClientHandshake(request *protocol.RequestHeader, reader io.Reader, writer i
account := rawAccount.(*Account)
b.AppendBytes(0x01, byte(len(account.Username)))
b.Append([]byte(account.Username))
b.Write([]byte(account.Username))
b.AppendBytes(byte(len(account.Password)))
b.Append([]byte(account.Password))
b.Write([]byte(account.Password))
}
if _, err := writer.Write(b.Bytes()); err != nil {