Documentation ¶
Index ¶
- Constants
- type AllowedFastMessage
- type BitfieldMessage
- type CancelMessage
- type ChokeMessage
- type ExtensionHandshakeMessage
- type ExtensionMessage
- type ExtensionMetadataMessage
- type ExtensionPEXMessage
- type HaveAllMessage
- type HaveMessage
- type HaveNoneMessage
- type InterestedMessage
- type Message
- type MessageID
- type NotInterestedMessage
- type PieceMessage
- type RejectMessage
- type RequestMessage
- type UnchokeMessage
Constants ¶
View Source
const ( ExtensionIDHandshake = iota ExtensionIDMetadata ExtensionIDPEX )
View Source
const ( ExtensionKeyMetadata = "ut_metadata" ExtensionKeyPEX = "ut_pex" )
View Source
const ( ExtensionMetadataMessageTypeRequest = iota ExtensionMetadataMessageTypeData ExtensionMetadataMessageTypeReject )
View Source
const ( Choke MessageID = iota Unchoke Interested NotInterested Have Bitfield Request Piece Cancel Port Suggest = 13 HaveAll = 14 HaveNone = 15 Reject = 16 AllowedFast = 17 Extension = 20 )
Peer message types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowedFastMessage ¶
type AllowedFastMessage struct{ HaveMessage }
type BitfieldMessage ¶
type BitfieldMessage struct {
Data []byte
}
func (BitfieldMessage) ID ¶
func (m BitfieldMessage) ID() MessageID
func (BitfieldMessage) MarshalBinary ¶
func (m BitfieldMessage) MarshalBinary() ([]byte, error)
type CancelMessage ¶
type CancelMessage struct{ RequestMessage }
func (CancelMessage) ID ¶
func (m CancelMessage) ID() MessageID
type ChokeMessage ¶
type ChokeMessage struct {
// contains filtered or unexported fields
}
func (ChokeMessage) ID ¶
func (m ChokeMessage) ID() MessageID
func (ChokeMessage) MarshalBinary ¶
type ExtensionHandshakeMessage ¶
type ExtensionHandshakeMessage struct { M map[string]uint8 `bencode:"m"` V string `bencode:"v"` YourIP string `bencode:"yourip,omitempty"` MetadataSize uint32 `bencode:"metadata_size,omitempty"` }
func NewExtensionHandshake ¶
func NewExtensionHandshake(metadataSize uint32, version string, yourip net.IP) ExtensionHandshakeMessage
type ExtensionMessage ¶
type ExtensionMessage struct { ExtendedMessageID uint8 Payload interface{} }
func (ExtensionMessage) ID ¶
func (m ExtensionMessage) ID() MessageID
func (ExtensionMessage) MarshalBinary ¶
func (m ExtensionMessage) MarshalBinary() ([]byte, error)
func (*ExtensionMessage) UnmarshalBinary ¶
func (m *ExtensionMessage) UnmarshalBinary(data []byte) error
type ExtensionPEXMessage ¶
type HaveAllMessage ¶
type HaveAllMessage struct {
// contains filtered or unexported fields
}
func (HaveAllMessage) ID ¶
func (m HaveAllMessage) ID() MessageID
func (HaveAllMessage) MarshalBinary ¶
type HaveMessage ¶
type HaveMessage struct {
Index uint32
}
func (HaveMessage) ID ¶
func (m HaveMessage) ID() MessageID
func (HaveMessage) MarshalBinary ¶
func (m HaveMessage) MarshalBinary() ([]byte, error)
type HaveNoneMessage ¶
type HaveNoneMessage struct {
// contains filtered or unexported fields
}
func (HaveNoneMessage) ID ¶
func (m HaveNoneMessage) ID() MessageID
func (HaveNoneMessage) MarshalBinary ¶
type InterestedMessage ¶
type InterestedMessage struct {
// contains filtered or unexported fields
}
func (InterestedMessage) ID ¶
func (m InterestedMessage) ID() MessageID
func (InterestedMessage) MarshalBinary ¶
type Message ¶
type Message interface { encoding.BinaryMarshaler ID() MessageID }
type NotInterestedMessage ¶
type NotInterestedMessage struct {
// contains filtered or unexported fields
}
func (NotInterestedMessage) ID ¶
func (m NotInterestedMessage) ID() MessageID
func (NotInterestedMessage) MarshalBinary ¶
type PieceMessage ¶
type PieceMessage struct {
Index, Begin uint32
}
func (PieceMessage) ID ¶
func (m PieceMessage) ID() MessageID
func (PieceMessage) MarshalBinary ¶
func (m PieceMessage) MarshalBinary() ([]byte, error)
type RejectMessage ¶
type RejectMessage struct{ RequestMessage }
func (RejectMessage) ID ¶
func (m RejectMessage) ID() MessageID
type RequestMessage ¶
type RequestMessage struct {
Index, Begin, Length uint32
}
func (RequestMessage) ID ¶
func (m RequestMessage) ID() MessageID
func (RequestMessage) MarshalBinary ¶
func (m RequestMessage) MarshalBinary() ([]byte, error)
type UnchokeMessage ¶
type UnchokeMessage struct {
// contains filtered or unexported fields
}
func (UnchokeMessage) ID ¶
func (m UnchokeMessage) ID() MessageID
func (UnchokeMessage) MarshalBinary ¶
Click to show internal directories.
Click to hide internal directories.