client

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SourceExchange2Version byte = 4

SourceExchange2Version 为当前实现的 SX2 载荷版本(与 aMule SOURCEEXCHANGE2_VERSION 一致)。

Variables

This section is empty.

Functions

func NewPacketCombiner

func NewPacketCombiner() protocol.PacketCombiner

func SwapUint32

func SwapUint32(x uint32) uint32

SwapUint32 与 aMule wxUINT32_SWAP_ALWAYS 一致,用于 UserID 混合编码与旧版 SX1 兼容。

Types

type AcceptUpload

type AcceptUpload struct {
	protocol.WithoutDataPacket
}

type AnswerSources2

type AnswerSources2 struct {
	Version byte
	Hash    protocol.Hash
	Entries []SourceExchangeEntry
}

AnswerSources2:OP_EMULEPROT OP_ANSWERSOURCES2 载荷。 顺序:uint8 版本 + 16 字节 hash + uint16 来源数量 + 每条目(版本依赖,见 Get)。

func (AnswerSources2) BytesCount

func (a AnswerSources2) BytesCount() int

func (*AnswerSources2) Get

func (a *AnswerSources2) Get(src *bytes.Reader) error

func (AnswerSources2) Put

func (a AnswerSources2) Put(dst *bytes.Buffer) error

type CancelTransfer

type CancelTransfer struct {
	protocol.WithoutDataPacket
}

type CompressedPart32

type CompressedPart32 struct {
	Hash             protocol.Hash
	BeginOffset      uint32
	CompressedLength uint32
}

func (CompressedPart32) BytesCount

func (c CompressedPart32) BytesCount() int

func (*CompressedPart32) Get

func (c *CompressedPart32) Get(src *bytes.Reader) error

func (CompressedPart32) PayloadSize

func (c CompressedPart32) PayloadSize() int

func (CompressedPart32) Put

func (c CompressedPart32) Put(dst *bytes.Buffer) error

type CompressedPart64

type CompressedPart64 struct {
	Hash             protocol.Hash
	BeginOffset      uint64
	CompressedLength uint32
}

func (CompressedPart64) BytesCount

func (c CompressedPart64) BytesCount() int

func (*CompressedPart64) Get

func (c *CompressedPart64) Get(src *bytes.Reader) error

func (CompressedPart64) PayloadSize

func (c CompressedPart64) PayloadSize() int

func (CompressedPart64) Put

func (c CompressedPart64) Put(dst *bytes.Buffer) error

type ExtHello

type ExtHello struct {
	ExtendedHandshake
}

type ExtHelloAnswer

type ExtHelloAnswer struct {
	ExtendedHandshake
}

type ExtendedHandshake

type ExtendedHandshake struct {
	Version         byte
	ProtocolVersion byte
	Properties      protocol.TagList
}

func (ExtendedHandshake) BytesCount

func (e ExtendedHandshake) BytesCount() int

func (*ExtendedHandshake) Get

func (e *ExtendedHandshake) Get(src *bytes.Reader) error

func (ExtendedHandshake) Put

func (e ExtendedHandshake) Put(dst *bytes.Buffer) error

type FileAnswer

type FileAnswer struct {
	Hash protocol.Hash
	Name protocol.ByteContainer16
}

func (FileAnswer) BytesCount

func (f FileAnswer) BytesCount() int

func (*FileAnswer) Get

func (f *FileAnswer) Get(src *bytes.Reader) error

func (FileAnswer) Put

func (f FileAnswer) Put(dst *bytes.Buffer) error

type FileRequest

type FileRequest struct {
	Hash protocol.Hash
}

func (FileRequest) BytesCount

func (f FileRequest) BytesCount() int

func (*FileRequest) Get

func (f *FileRequest) Get(src *bytes.Reader) error

func (FileRequest) Put

func (f FileRequest) Put(dst *bytes.Buffer) error

type FileStatusAnswer

type FileStatusAnswer struct {
	Hash     protocol.Hash
	BitField protocol.BitField
}

func (FileStatusAnswer) BytesCount

func (f FileStatusAnswer) BytesCount() int

func (*FileStatusAnswer) Get

func (f *FileStatusAnswer) Get(src *bytes.Reader) error

func (FileStatusAnswer) Put

func (f FileStatusAnswer) Put(dst *bytes.Buffer) error

type FileStatusRequest

type FileStatusRequest struct {
	Hash protocol.Hash
}

func (FileStatusRequest) BytesCount

func (f FileStatusRequest) BytesCount() int

func (*FileStatusRequest) Get

func (f *FileStatusRequest) Get(src *bytes.Reader) error

func (FileStatusRequest) Put

func (f FileStatusRequest) Put(dst *bytes.Buffer) error

type HashSetAnswer

type HashSetAnswer struct {
	Hash  protocol.Hash
	Parts []protocol.Hash
}

func (HashSetAnswer) BytesCount

func (h HashSetAnswer) BytesCount() int

func (*HashSetAnswer) Get

func (h *HashSetAnswer) Get(src *bytes.Reader) error

func (HashSetAnswer) Put

func (h HashSetAnswer) Put(dst *bytes.Buffer) error

type HashSetRequest

type HashSetRequest struct {
	Hash protocol.Hash
}

func (HashSetRequest) BytesCount

func (h HashSetRequest) BytesCount() int

func (*HashSetRequest) Get

func (h *HashSetRequest) Get(src *bytes.Reader) error

func (HashSetRequest) Put

func (h HashSetRequest) Put(dst *bytes.Buffer) error

type Hello

type Hello struct {
	HashLength byte
	HelloAnswer
}

func (Hello) BytesCount

func (h Hello) BytesCount() int

func (*Hello) Get

func (h *Hello) Get(src *bytes.Reader) error

func (Hello) Put

func (h Hello) Put(dst *bytes.Buffer) error

type HelloAnswer

type HelloAnswer struct {
	Hash        protocol.Hash
	Point       protocol.Endpoint
	Properties  protocol.TagList
	ServerPoint protocol.Endpoint
}

func (HelloAnswer) BytesCount

func (h HelloAnswer) BytesCount() int

func (*HelloAnswer) Get

func (h *HelloAnswer) Get(src *bytes.Reader) error

func (HelloAnswer) Put

func (h HelloAnswer) Put(dst *bytes.Buffer) error

type NoFileStatus

type NoFileStatus struct {
	Hash protocol.Hash
}

func (NoFileStatus) BytesCount

func (n NoFileStatus) BytesCount() int

func (*NoFileStatus) Get

func (n *NoFileStatus) Get(src *bytes.Reader) error

func (NoFileStatus) Put

func (n NoFileStatus) Put(dst *bytes.Buffer) error

type OutOfParts

type OutOfParts struct {
	protocol.WithoutDataPacket
}

type QueueRanking

type QueueRanking struct {
	Rank     uint16
	Padding1 uint32
	Padding2 uint32
	Padding3 uint16
}

func (QueueRanking) BytesCount

func (q QueueRanking) BytesCount() int

func (*QueueRanking) Get

func (q *QueueRanking) Get(src *bytes.Reader) error

func (QueueRanking) Put

func (q QueueRanking) Put(dst *bytes.Buffer) error

type RequestParts32

type RequestParts32 struct {
	Hash        protocol.Hash
	CurrentFree int
	BeginOffset [partsInRequest]uint32
	EndOffset   [partsInRequest]uint32
}

func (*RequestParts32) AppendRange

func (r *RequestParts32) AppendRange(rg data.Range)

func (RequestParts32) BytesCount

func (r RequestParts32) BytesCount() int

func (*RequestParts32) Get

func (r *RequestParts32) Get(src *bytes.Reader) error

func (RequestParts32) Put

func (r RequestParts32) Put(dst *bytes.Buffer) error

type RequestParts64

type RequestParts64 struct {
	Hash        protocol.Hash
	CurrentFree int
	BeginOffset [partsInRequest]uint64
	EndOffset   [partsInRequest]uint64
}

func (*RequestParts64) AppendRange

func (r *RequestParts64) AppendRange(rg data.Range)

func (RequestParts64) BytesCount

func (r RequestParts64) BytesCount() int

func (*RequestParts64) Get

func (r *RequestParts64) Get(src *bytes.Reader) error

func (RequestParts64) Put

func (r RequestParts64) Put(dst *bytes.Buffer) error

type RequestSources2

type RequestSources2 struct {
	Version  byte
	Reserved uint16
	Hash     protocol.Hash
}

RequestSources2:OP_EMULEPROT OP_REQUESTSOURCES2 载荷。 顺序:uint8 版本(SourceExchange2Version)+ uint16 保留(0) + 16 字节文件 hash。

func (RequestSources2) BytesCount

func (r RequestSources2) BytesCount() int

func (*RequestSources2) Get

func (r *RequestSources2) Get(src *bytes.Reader) error

func (RequestSources2) Put

func (r RequestSources2) Put(dst *bytes.Buffer) error

type SendingPart32

type SendingPart32 struct {
	Hash        protocol.Hash
	BeginOffset uint32
	EndOffset   uint32
}

func (SendingPart32) BytesCount

func (s SendingPart32) BytesCount() int

func (*SendingPart32) Get

func (s *SendingPart32) Get(src *bytes.Reader) error

func (SendingPart32) PayloadSize

func (s SendingPart32) PayloadSize() int

func (SendingPart32) Put

func (s SendingPart32) Put(dst *bytes.Buffer) error

type SendingPart64

type SendingPart64 struct {
	Hash        protocol.Hash
	BeginOffset uint64
	EndOffset   uint64
}

func (SendingPart64) BytesCount

func (s SendingPart64) BytesCount() int

func (*SendingPart64) Get

func (s *SendingPart64) Get(src *bytes.Reader) error

func (SendingPart64) PayloadSize

func (s SendingPart64) PayloadSize() int

func (SendingPart64) Put

func (s SendingPart64) Put(dst *bytes.Buffer) error

type SourceExchangeEntry

type SourceExchangeEntry struct {
	UserID       uint32
	TCPPort      uint16
	ServerIP     uint32
	ServerPort   uint16
	UserHash     protocol.Hash
	CryptOptions uint8
}

SourceExchangeEntry 表示 AnswerSources2 中单个来源(SX2 v4:含 UserHash 与 CryptOptions)。

type StartUpload

type StartUpload struct {
	Hash protocol.Hash
}

func (StartUpload) BytesCount

func (s StartUpload) BytesCount() int

func (*StartUpload) Get

func (s *StartUpload) Get(src *bytes.Reader) error

func (StartUpload) Put

func (s StartUpload) Put(dst *bytes.Buffer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL