Documentation
¶
Index ¶
- Constants
- func MultiPacketOpcode() byte
- func NewPacketCombiner() protocol.PacketCombiner
- func PackMultiPacketExt2(frames [][]byte) ([]byte, error)
- func SwapUint32(x uint32) uint32
- func UnpackMultiPacketExt2(payload []byte) ([][]byte, error)
- type AICHAnswer
- type AICHFileHashAnswer
- type AICHFileHashRequest
- type AICHRequest
- type AcceptUpload
- type AnswerSources
- type AnswerSources2
- type CancelTransfer
- type CompressedPart32
- type CompressedPart64
- type ExtHello
- type ExtHelloAnswer
- type ExtendedHandshake
- type FileAnswer
- type FileComment
- type FileRequest
- type FileStatusAnswer
- type FileStatusRequest
- type HashSetAnswer
- type HashSetRequest
- type Hello
- type HelloAnswer
- type NoFileStatus
- type OutOfParts
- type PreviewAnswer
- type PublicKey
- type QueueRanking
- type RequestParts32
- type RequestParts64
- type RequestPreview
- type RequestSources
- type RequestSources2
- type SecIdentState
- type SendingPart32
- type SendingPart64
- type Signature
- type SourceExchangeEntry
- type StartUpload
Constants ¶
const ( SecIdentMaxPubKeyLen = 512 SecIdentMaxSigLen = 512 )
const MaxFileCommentLen = 128
const MaxPreviewBytes = 256 * 1024
const SourceExchange2Version byte = 4
SourceExchange2Version 为当前实现的 SX2 载荷版本(与 aMule SOURCEEXCHANGE2_VERSION 一致)。
const SourceExchangeIPv6Version byte = 5
SourceExchangeIPv6Version 为 goed2k 扩展的 IPv6 来源交换版本(v4 条目后追加 16 字节 IPv6)。
Variables ¶
This section is empty.
Functions ¶
func MultiPacketOpcode ¶ added in v0.1.3
func MultiPacketOpcode() byte
MultiPacketOpcode 返回 OP_MULTIPACKET_EXT2 操作码(供连接层识别)。
func NewPacketCombiner ¶
func NewPacketCombiner() protocol.PacketCombiner
func PackMultiPacketExt2 ¶ added in v0.1.3
PackMultiPacketExt2 将多条已编码的 eMule TCP 帧 zlib 压缩后以 OP_MULTIPACKET_EXT2 (0xA9) 发出。
func SwapUint32 ¶
SwapUint32 与 aMule wxUINT32_SWAP_ALWAYS 一致,用于 UserID 混合编码与旧版 SX1 兼容。
func UnpackMultiPacketExt2 ¶ added in v0.1.3
UnpackMultiPacketExt2 解压 MultiPacket 载荷,返回内部原始 TCP 帧列表。
Types ¶
type AICHAnswer ¶ added in v0.1.0
func (AICHAnswer) BytesCount ¶ added in v0.1.0
func (a AICHAnswer) BytesCount() int
type AICHFileHashAnswer ¶ added in v0.1.0
AICHFileHashAnswer returns the file-level AICH root hash (deprecated in eMule).
func (AICHFileHashAnswer) BytesCount ¶ added in v0.1.0
func (a AICHFileHashAnswer) BytesCount() int
type AICHFileHashRequest ¶ added in v0.1.0
AICHFileHashRequest asks for the file-level AICH root hash (deprecated in eMule).
func (AICHFileHashRequest) BytesCount ¶ added in v0.1.0
func (a AICHFileHashRequest) BytesCount() int
type AICHRequest ¶ added in v0.1.0
func (AICHRequest) BytesCount ¶ added in v0.1.0
func (a AICHRequest) BytesCount() int
type AcceptUpload ¶
type AcceptUpload struct {
protocol.WithoutDataPacket
}
type AnswerSources ¶ added in v0.1.3
type AnswerSources struct {
Hash protocol.Hash
Entries []SourceExchangeEntry
}
AnswerSources(SX1):OP_EMULEPROT OP_ANSWERSOURCES (0x82)。 顺序:16 字节 hash + uint16 数量 + 每条目 12 字节(UserID、TCPPort、ServerIP、ServerPort)。
func (AnswerSources) BytesCount ¶ added in v0.1.3
func (a AnswerSources) BytesCount() int
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
type CancelTransfer ¶
type CancelTransfer struct {
protocol.WithoutDataPacket
}
type CompressedPart32 ¶
func (CompressedPart32) BytesCount ¶
func (c CompressedPart32) BytesCount() int
func (CompressedPart32) PayloadSize ¶
func (c CompressedPart32) PayloadSize() int
type CompressedPart64 ¶
func (CompressedPart64) BytesCount ¶
func (c CompressedPart64) BytesCount() int
func (CompressedPart64) PayloadSize ¶
func (c CompressedPart64) PayloadSize() int
type ExtHello ¶
type ExtHello struct {
ExtendedHandshake
}
type ExtHelloAnswer ¶
type ExtHelloAnswer struct {
ExtendedHandshake
}
type ExtendedHandshake ¶
func (ExtendedHandshake) BytesCount ¶
func (e ExtendedHandshake) BytesCount() int
type FileAnswer ¶
type FileAnswer struct {
Hash protocol.Hash
Name protocol.ByteContainer16
}
func (FileAnswer) BytesCount ¶
func (f FileAnswer) BytesCount() int
type FileComment ¶ added in v0.1.0
FileComment carries a peer file rating and comment (OP_FILEDESC / 0x61).
func (FileComment) BytesCount ¶ added in v0.1.0
func (f FileComment) BytesCount() int
type FileRequest ¶
func (FileRequest) BytesCount ¶
func (f FileRequest) BytesCount() int
type FileStatusAnswer ¶
func (FileStatusAnswer) BytesCount ¶
func (f FileStatusAnswer) BytesCount() int
type FileStatusRequest ¶
func (FileStatusRequest) BytesCount ¶
func (f FileStatusRequest) BytesCount() int
type HashSetAnswer ¶
func (HashSetAnswer) BytesCount ¶
func (h HashSetAnswer) BytesCount() int
type HashSetRequest ¶
func (HashSetRequest) BytesCount ¶
func (h HashSetRequest) BytesCount() int
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
type NoFileStatus ¶
func (NoFileStatus) BytesCount ¶
func (n NoFileStatus) BytesCount() int
type OutOfParts ¶
type OutOfParts struct {
protocol.WithoutDataPacket
}
type PreviewAnswer ¶ added in v0.1.3
PreviewAnswer:OP_EMULEPROT OP_PREVIEWANSWER (0x91)。 载荷:16 字节 hash + uint16 分片索引 + uint32 数据长度 + 数据。
func (PreviewAnswer) BytesCount ¶ added in v0.1.3
func (p PreviewAnswer) BytesCount() int
type PublicKey ¶ added in v0.1.0
type PublicKey struct {
Key []byte
}
func (PublicKey) BytesCount ¶ added in v0.1.0
type QueueRanking ¶
func (QueueRanking) BytesCount ¶
func (q QueueRanking) BytesCount() int
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
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
type RequestPreview ¶ added in v0.1.3
RequestPreview:OP_EMULEPROT OP_REQUESTPREVIEW (0x90)。 载荷:16 字节 hash + uint16 预览分片索引(eMule 按分片请求预览数据)。
func (RequestPreview) BytesCount ¶ added in v0.1.3
func (r RequestPreview) BytesCount() int
type RequestSources ¶ added in v0.1.3
RequestSources(SX1):OP_EMULEPROT OP_REQUESTSOURCES (0x81),载荷为 16 字节文件 hash。
func (RequestSources) BytesCount ¶ added in v0.1.3
func (r RequestSources) BytesCount() int
type RequestSources2 ¶
RequestSources2:OP_EMULEPROT OP_REQUESTSOURCES2 载荷。 顺序:uint8 版本(SourceExchange2Version)+ uint16 保留(0) + 16 字节文件 hash。
func (RequestSources2) BytesCount ¶
func (r RequestSources2) BytesCount() int
type SecIdentState ¶ added in v0.1.0
func (SecIdentState) BytesCount ¶ added in v0.1.0
func (s SecIdentState) BytesCount() int
type SendingPart32 ¶
func (SendingPart32) BytesCount ¶
func (s SendingPart32) BytesCount() int
func (SendingPart32) PayloadSize ¶
func (s SendingPart32) PayloadSize() int
type SendingPart64 ¶
func (SendingPart64) BytesCount ¶
func (s SendingPart64) BytesCount() int
func (SendingPart64) PayloadSize ¶
func (s SendingPart64) PayloadSize() int
type Signature ¶ added in v0.1.0
type Signature struct {
Signature []byte
}
func (Signature) BytesCount ¶ added in v0.1.0
type SourceExchangeEntry ¶
type SourceExchangeEntry struct {
UserID uint32
TCPPort uint16
ServerIP uint32
ServerPort uint16
UserHash protocol.Hash
CryptOptions uint8
IPv6 [16]byte
}
SourceExchangeEntry 表示 AnswerSources2 中单个来源(SX2 v4:含 UserHash 与 CryptOptions;v5 追加 IPv6)。
func (SourceExchangeEntry) EntryHasIPv6 ¶ added in v0.1.3
func (e SourceExchangeEntry) EntryHasIPv6() bool
EntryHasIPv6 判断条目是否携带有效 IPv6 地址。
func (SourceExchangeEntry) EntryIPv6Addr ¶ added in v0.1.3
func (e SourceExchangeEntry) EntryIPv6Addr() net.IP
EntryIPv6Addr 返回条目的 IPv6 地址(无则 nil)。
type StartUpload ¶
func (StartUpload) BytesCount ¶
func (s StartUpload) BytesCount() int
Source Files
¶
- accept_upload.go
- aich.go
- cancel_transfer.go
- compressed_part.go
- ext_hello.go
- ext_hello_answer.go
- extended_handshake.go
- file_answer.go
- file_comment.go
- file_request.go
- file_status_answer.go
- file_status_request.go
- hash_set_answer.go
- hash_set_request.go
- hello.go
- hello_answer.go
- multipacket.go
- no_file_status.go
- out_of_parts.go
- packet_combiner.go
- preview.go
- queue_ranking.go
- request_parts.go
- sec_ident.go
- sending_part.go
- source_exchange.go
- source_exchange_sx1.go
- start_upload.go