1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-16 04:35:24 +00:00

rename buf type adaptor into FromBytes

This commit is contained in:
Shelikhoo 2021-11-07 22:45:36 +00:00
parent 802780e9e1
commit 65174fa487
No known key found for this signature in database
GPG Key ID: AA7BC347968E7DB1
3 changed files with 5 additions and 5 deletions

View File

@ -30,8 +30,8 @@ func New() *Buffer {
}
}
// As creates a Buffer with an existed bytearray
func As(data []byte) *Buffer {
// FromBytes creates a Buffer with an existed bytearray
func FromBytes(data []byte) *Buffer {
return &Buffer{
v: data,
end: int32(len(data)),

View File

@ -40,7 +40,7 @@ func SniffUTP(b []byte) (*SniffHeader, error) {
return nil, common.ErrNoClue
}
buffer := buf.As(b)
buffer := buf.FromBytes(b)
var typeAndVersion uint8

View File

@ -49,7 +49,7 @@ var (
)
func SniffQUIC(b []byte) (*SniffHeader, error) {
buffer := buf.As(b)
buffer := buf.FromBytes(b)
typeByte, err := buffer.ReadByte()
if err != nil {
return nil, errNotQuic
@ -161,7 +161,7 @@ func SniffQUIC(b []byte) (*SniffHeader, error) {
if err != nil {
return nil, err
}
buffer = buf.As(decrypted)
buffer = buf.FromBytes(decrypted)
frameType, err := buffer.ReadByte()
if err != nil {
return nil, io.ErrUnexpectedEOF