mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 04:47:40 +03:00
Remove legacy buffer header
This commit is contained in:
parent
99d07d6e5a
commit
d7ce998e7e
4 changed files with 11 additions and 17 deletions
|
@ -11,8 +11,6 @@ import (
|
|||
E "github.com/sagernet/sing/common/exceptions"
|
||||
)
|
||||
|
||||
const ReversedHeader = 1024
|
||||
|
||||
type Buffer struct {
|
||||
data []byte
|
||||
start int
|
||||
|
@ -25,8 +23,6 @@ type Buffer struct {
|
|||
func New() *Buffer {
|
||||
return &Buffer{
|
||||
data: Get(BufferSize),
|
||||
start: ReversedHeader,
|
||||
end: ReversedHeader,
|
||||
managed: true,
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +30,6 @@ func New() *Buffer {
|
|||
func NewPacket() *Buffer {
|
||||
return &Buffer{
|
||||
data: Get(UDPBufferSize),
|
||||
start: ReversedHeader,
|
||||
end: ReversedHeader,
|
||||
managed: true,
|
||||
}
|
||||
}
|
||||
|
@ -277,15 +271,15 @@ func (b *Buffer) Resize(start, end int) {
|
|||
}
|
||||
|
||||
func (b *Buffer) Reset() {
|
||||
b.start = ReversedHeader
|
||||
b.end = ReversedHeader
|
||||
}
|
||||
|
||||
func (b *Buffer) FullReset() {
|
||||
b.start = 0
|
||||
b.end = 0
|
||||
}
|
||||
|
||||
// Deprecated: use Reset instead.
|
||||
func (b *Buffer) FullReset() {
|
||||
b.Reset()
|
||||
}
|
||||
|
||||
func (b *Buffer) IncRef() {
|
||||
atomic.AddInt32(&b.refs, 1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue