mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-03 00:22:05 +00:00
More doc
This commit is contained in:
1 parent
2a85c62e14
commit
702aaacac3
4 files changed
+23
No files matched your search
@@ -4,12 +4,14 @@ import (
|
||||
"github.com/v2ray/v2ray-core/common/alloc"
|
||||
)
|
||||
|
||||
// Packet is a network packet to be sent to destination.
|
||||
type Packet interface {
|
||||
Destination() Destination
|
||||
Chunk() *alloc.Buffer // First chunk of this commnunication
|
||||
MoreChunks() bool
|
||||
}
|
||||
|
||||
// NewPacket creates a new Packet with given destination and payload.
|
||||
func NewPacket(dest Destination, firstChunk *alloc.Buffer, moreChunks bool) Packet {
|
||||
return &packetImpl{
|
||||
dest: dest,
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/v2ray/v2ray-core/common/alloc"
|
||||
)
|
||||
|
||||
// ReadFrom reads from a reader and put all content to a buffer.
|
||||
// If buffer is nil, ReadFrom creates a new normal buffer.
|
||||
func ReadFrom(reader io.Reader, buffer *alloc.Buffer) (*alloc.Buffer, error) {
|
||||
if buffer == nil {
|
||||
buffer = alloc.NewBuffer()
|
||||
|
||||
Reference in new issue
Block a user