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
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
type ExtensionHandshakeMessage ¶
type ExtensionHandshakeMessage struct { M map[string]uint8 `bencode:"m"` V string `bencode:"v"` YourIP string `bencode:"yourip,omitempty"` MetadataSize int `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) 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
type HaveMessage ¶
type HaveMessage struct {
Index uint32
}
func (HaveMessage) ID ¶
func (m HaveMessage) ID() MessageID
type HaveNoneMessage ¶
type HaveNoneMessage struct {
// contains filtered or unexported fields
}
func (HaveNoneMessage) ID ¶
func (m HaveNoneMessage) ID() MessageID
type InterestedMessage ¶
type InterestedMessage struct {
// contains filtered or unexported fields
}
func (InterestedMessage) ID ¶
func (m InterestedMessage) ID() MessageID
type NotInterestedMessage ¶
type NotInterestedMessage struct {
// contains filtered or unexported fields
}
func (NotInterestedMessage) ID ¶
func (m NotInterestedMessage) ID() MessageID
type PieceMessage ¶
type PieceMessage struct {
Index, Begin uint32
}
func (PieceMessage) ID ¶
func (m PieceMessage) ID() MessageID
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
Click to show internal directories.
Click to hide internal directories.