mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-07 05:47:38 +03:00
Add http support for sslocal
This commit is contained in:
parent
542fa4f975
commit
26e13e7beb
30 changed files with 1355 additions and 194 deletions
|
@ -25,6 +25,20 @@ func New() *Buffer {
|
|||
}
|
||||
}
|
||||
|
||||
func NewSize(size int) *Buffer {
|
||||
if size <= 128 || size > BufferSize {
|
||||
return &Buffer{
|
||||
data: make([]byte, size),
|
||||
}
|
||||
}
|
||||
return &Buffer{
|
||||
data: GetBytes(),
|
||||
start: ReversedHeader,
|
||||
end: ReversedHeader,
|
||||
managed: true,
|
||||
}
|
||||
}
|
||||
|
||||
func FullNew() *Buffer {
|
||||
return &Buffer{
|
||||
data: GetBytes(),
|
||||
|
@ -57,6 +71,20 @@ func As(data []byte) *Buffer {
|
|||
}
|
||||
}
|
||||
|
||||
func Or(data []byte, size int) *Buffer {
|
||||
max := cap(data)
|
||||
if size != max {
|
||||
data = data[:max]
|
||||
}
|
||||
if cap(data) >= size {
|
||||
return &Buffer{
|
||||
data: data,
|
||||
}
|
||||
} else {
|
||||
return NewSize(size)
|
||||
}
|
||||
}
|
||||
|
||||
func With(data []byte) *Buffer {
|
||||
return &Buffer{
|
||||
data: data,
|
||||
|
@ -346,7 +374,7 @@ func (b Buffer) Copy() []byte {
|
|||
func ReleaseMulti(mb *list.List[*Buffer]) {
|
||||
for entry := mb.Front(); entry != nil; entry = entry.Next() {
|
||||
// TODO: remove cast
|
||||
var buffer *Buffer = entry.Value
|
||||
buffer := entry.Value
|
||||
buffer.Release()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue