mirror of https://github.com/v2ray/v2ray-core
parent
00dd7d5cd2
commit
94405dd467
|
@ -110,7 +110,7 @@ func snifer(ctx context.Context, sniferList []proxyman.KnownProtocols, outbound
|
||||||
if mb.IsEmpty() {
|
if mb.IsEmpty() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
nBytes, _ := mb.Read(payload)
|
nBytes := mb.Copy(payload)
|
||||||
for _, protocol := range sniferList {
|
for _, protocol := range sniferList {
|
||||||
var f func([]byte) (string, error)
|
var f func([]byte) (string, error)
|
||||||
switch protocol {
|
switch protocol {
|
||||||
|
|
|
@ -31,6 +31,18 @@ func (mb *MultiBuffer) AppendMulti(buf MultiBuffer) {
|
||||||
*mb = append(*mb, buf...)
|
*mb = append(*mb, buf...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mb MultiBuffer) Copy(b []byte) int {
|
||||||
|
total := 0
|
||||||
|
for _, bb := range mb {
|
||||||
|
nBytes := copy(b[total:], bb.Bytes())
|
||||||
|
total += nBytes
|
||||||
|
if nBytes < bb.Len() {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
func (mb *MultiBuffer) Read(b []byte) (int, error) {
|
func (mb *MultiBuffer) Read(b []byte) (int, error) {
|
||||||
endIndex := len(*mb)
|
endIndex := len(*mb)
|
||||||
totalBytes := 0
|
totalBytes := 0
|
||||||
|
|
Loading…
Reference in New Issue