Documentation
¶
Index ¶
- Constants
- Variables
- func ReadBytes(src *bytes.Reader, size int) ([]byte, error)
- func ReadInt32(src *bytes.Reader) (int32, error)
- func ReadUInt16(src *bytes.Reader) (uint16, error)
- func ReadUInt32(src *bytes.Reader) (uint32, error)
- func ReadUInt64(src *bytes.Reader) (uint64, error)
- func WriteEndpoint(dst *bytes.Buffer, endpoint Endpoint) error
- func WriteHash(dst *bytes.Buffer, hash Hash) error
- func WriteInt32(dst *bytes.Buffer, value int32) error
- func WriteUInt16(dst *bytes.Buffer, value uint16) error
- func WriteUInt32(dst *bytes.Buffer, value uint32) error
- func WriteUInt64(dst *bytes.Buffer, value uint64) error
- type BitField
- func (b *BitField) Assign(raw []byte, bits int)
- func (b BitField) Bits() []bool
- func (b BitField) BytesCount() int
- func (b *BitField) ClearAll()
- func (b *BitField) ClearBit(index int)
- func (b BitField) Count() int
- func (b *BitField) Get(src *bytes.Reader) error
- func (b BitField) GetBit(index int) bool
- func (b BitField) Len() int
- func (b BitField) Put(dst *bytes.Buffer) error
- func (b *BitField) Resize(size int)
- func (b *BitField) ResizeWith(size int, val bool)
- func (b *BitField) SetAll()
- func (b *BitField) SetBit(index int)
- type ByteContainer16
- type Endpoint
- func (e *Endpoint) Assign(ip int32, port int) Endpoint
- func (e *Endpoint) AssignEndpoint(point Endpoint) Endpoint
- func (e Endpoint) Compare(other Endpoint) int
- func (e Endpoint) Defined() bool
- func (e Endpoint) Equal(other Endpoint) bool
- func (e Endpoint) HashCode() int32
- func (e Endpoint) IP() int32
- func (e Endpoint) IsZero() bool
- func (e Endpoint) MarshalJSON() ([]byte, error)
- func (e Endpoint) Port() int
- func (e *Endpoint) SetIP(ip int32)
- func (e *Endpoint) SetPort(port int)
- func (e Endpoint) String() string
- func (e Endpoint) ToTCPAddr() (*net.TCPAddr, error)
- func (e *Endpoint) UnmarshalJSON(data []byte) error
- type Hash
- func HashFromBytes(value []byte) (Hash, error)
- func HashFromData(value []byte) (Hash, error)
- func HashFromHashSet(hashes []Hash) Hash
- func HashFromString(value string) (Hash, error)
- func MustHashFromString(value string) Hash
- func RandomHash(eMule bool) (Hash, error)
- func ReadHash(src *bytes.Reader) (Hash, error)
- func (h *Hash) Assign(other Hash) Hash
- func (h Hash) At(index int) byte
- func (h Hash) Bytes() []byte
- func (h Hash) Compare(other Hash) int
- func (h Hash) Equal(other Hash) bool
- func (h Hash) IsZero() bool
- func (h Hash) MarshalJSON() ([]byte, error)
- func (h *Hash) Set(index int, value byte)
- func (h Hash) String() string
- func (h *Hash) UnmarshalJSON(data []byte) error
- type PacketCombiner
- func (p *PacketCombiner) Pack(typeName string, object Serializable) ([]byte, error)
- func (p *PacketCombiner) PackPayload(typeName string, object Serializable, payload []byte) ([]byte, int, error)
- func (p *PacketCombiner) Register(key PacketKey, typeName string, factory packetFactory)
- func (p PacketCombiner) ServiceSize(header PacketHeader) int
- func (p *PacketCombiner) SetServiceSizer(fn serviceSizer)
- func (p *PacketCombiner) Unpack(header PacketHeader, src []byte) (Serializable, error)
- func (p *PacketCombiner) UnpackFrame(frame []byte) (PacketHeader, Serializable, error)
- type PacketHeader
- func (p PacketHeader) BytesCount() int
- func (p *PacketHeader) Get(src *bytes.Reader) error
- func (p PacketHeader) IsDefined() bool
- func (p PacketHeader) Key() PacketKey
- func (p PacketHeader) Put(dst *bytes.Buffer) error
- func (p *PacketHeader) Reset()
- func (p *PacketHeader) ResetWithKey(key PacketKey, size int32)
- func (p PacketHeader) SizePacket() int32
- func (p PacketHeader) String() string
- type PacketKey
- type Serializable
- type SimpleTag
- type TagList
- type TransferResumeData
- type WithoutDataPacket
Constants ¶
View Source
const ( FTFilename byte = 0x01 FTFileSize byte = 0x02 FTFileType byte = 0x03 FTFileFormat byte = 0x04 FTSources byte = 0x15 FTCompleteSources byte = 0x30 FTFileSizeHi byte = 0x3A FTMediaLength byte = 0xD3 FTMediaBitrate byte = 0xD4 FTMediaCodec byte = 0xD5 )
View Source
const ( OpUndefined byte = 0x00 EdonkeyHeader byte = 0xE3 EdonkeyProt byte = 0xE3 PackedProt byte = 0xD4 EMuleProt byte = 0xC5 KadCompressedUDP byte = 0xE5 KademliaHeader byte = 0xE4 PacketHeaderSize = 6 )
View Source
const ( TagTypeString = 0x02 TagTypeUint32 = 0x03 TagTypeUint16 = 0x08 TagTypeUint8 = 0x09 TagTypeUint64 = 0x0B TagTypeStr1 = 0x11 )
Variables ¶
View Source
var ( Terminal = MustHashFromString("31D6CFE0D16AE931B73C59D7E0C089C0") LibED2K = MustHashFromString("31D6CFE0D14CE931B73C59D7E0C04BC0") EMule = MustHashFromString("31D6CFE0D10EE931B73C59D7E0C06FC0") Invalid Hash )
Functions ¶
Types ¶
type BitField ¶
type BitField struct {
// contains filtered or unexported fields
}
func NewBitField ¶
func (BitField) BytesCount ¶
func (*BitField) ResizeWith ¶
type ByteContainer16 ¶
type ByteContainer16 struct {
Value []byte
}
func ByteContainer16FromString ¶
func ByteContainer16FromString(value string) ByteContainer16
func (ByteContainer16) AsString ¶
func (b ByteContainer16) AsString() string
func (ByteContainer16) BytesCount ¶
func (b ByteContainer16) BytesCount() int
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func EndpointFromInet ¶
func NewEndpoint ¶
func (*Endpoint) AssignEndpoint ¶
func (Endpoint) MarshalJSON ¶
func (*Endpoint) UnmarshalJSON ¶
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
func HashFromBytes ¶
func HashFromData ¶
func HashFromHashSet ¶
func HashFromString ¶
func MustHashFromString ¶
func RandomHash ¶
func (Hash) MarshalJSON ¶
func (*Hash) UnmarshalJSON ¶
type PacketCombiner ¶
type PacketCombiner struct {
// contains filtered or unexported fields
}
func NewPacketCombiner ¶
func NewPacketCombiner() PacketCombiner
func (*PacketCombiner) Pack ¶
func (p *PacketCombiner) Pack(typeName string, object Serializable) ([]byte, error)
func (*PacketCombiner) PackPayload ¶
func (p *PacketCombiner) PackPayload(typeName string, object Serializable, payload []byte) ([]byte, int, error)
func (*PacketCombiner) Register ¶
func (p *PacketCombiner) Register(key PacketKey, typeName string, factory packetFactory)
func (PacketCombiner) ServiceSize ¶
func (p PacketCombiner) ServiceSize(header PacketHeader) int
func (*PacketCombiner) SetServiceSizer ¶
func (p *PacketCombiner) SetServiceSizer(fn serviceSizer)
func (*PacketCombiner) Unpack ¶
func (p *PacketCombiner) Unpack(header PacketHeader, src []byte) (Serializable, error)
func (*PacketCombiner) UnpackFrame ¶
func (p *PacketCombiner) UnpackFrame(frame []byte) (PacketHeader, Serializable, error)
type PacketHeader ¶
func (PacketHeader) BytesCount ¶
func (p PacketHeader) BytesCount() int
func (PacketHeader) IsDefined ¶
func (p PacketHeader) IsDefined() bool
func (PacketHeader) Key ¶
func (p PacketHeader) Key() PacketKey
func (*PacketHeader) Reset ¶
func (p *PacketHeader) Reset()
func (*PacketHeader) ResetWithKey ¶
func (p *PacketHeader) ResetWithKey(key PacketKey, size int32)
func (PacketHeader) SizePacket ¶
func (p PacketHeader) SizePacket() int32
func (PacketHeader) String ¶
func (p PacketHeader) String() string
type PacketKey ¶
func (PacketKey) NormalizedProtocol ¶
type Serializable ¶
type TransferResumeData ¶
type TransferResumeData struct {
Hashes []Hash
Pieces BitField
DownloadedBlocks []data.PieceBlock
Peers []Endpoint
}
func (TransferResumeData) MarshalJSON ¶
func (r TransferResumeData) MarshalJSON() ([]byte, error)
func (*TransferResumeData) UnmarshalJSON ¶
func (r *TransferResumeData) UnmarshalJSON(data []byte) error
type WithoutDataPacket ¶
type WithoutDataPacket struct{}
func (WithoutDataPacket) BytesCount ¶
func (w WithoutDataPacket) BytesCount() int
Source Files
¶
Click to show internal directories.
Click to hide internal directories.