Documentation
¶
Index ¶
- Constants
- func DecodePacket(packet []byte) (byte, []byte, error)
- func DistanceCompare(a, b, target ID) int
- type BootstrapReq
- type BootstrapRes
- type CallbackReq
- type EmptyPacket
- type Endpoint
- type Entry
- type FindBuddyReq
- type FindBuddyRes
- type FirewalledReq
- type FirewalledRes
- type FirewalledUDP
- type Hello
- type HelloResAck
- type ID
- type LegacyFirewalledReq
- type NodesDat
- type PacketCombiner
- type Ping
- type Pong
- type PublishKeysReq
- type PublishNotesReq
- type PublishNotesRes
- type PublishRes
- type PublishResAck
- type PublishSourcesReq
- type Req
- type Res
- type SearchEntry
- type SearchKeysReq
- type SearchNotesReq
- type SearchNotesRes
- type SearchRes
- type SearchSourcesReq
- type Tag
Constants ¶
View Source
const ( BootstrapReqOp byte = 0x01 BootstrapResOp byte = 0x09 ReqOp byte = 0x21 ResOp byte = 0x29 HelloReqOp byte = 0x11 HelloResOp byte = 0x19 HelloResAckOp byte = 0x22 SearchKeysReqOp byte = 0x33 SearchNotesResOp byte = 0x3A CallbackReqOp byte = 0x52 FindBuddyReqOp byte = 0x51 FindBuddyResOp byte = 0x5A LegacyFirewalledReqOp byte = 0x50 FirewalledReqOp byte = 0x53 FirewalledResOp byte = 0x58 FirewalledUdpOp byte = 0x62 PingOp byte = 0x60 PongOp byte = 0x61 PublishSourceReqOp byte = 0x44 PublishKeysReqOp byte = 0x43 PublishNotesReqOp byte = 0x45 PublishNotesResOp byte = 0x4A PublishResOp byte = 0x4B PublishResAckOp byte = 0x4C SearchNotesReqOp byte = 0x35 KademliaVersion byte = 0x05 FindValue byte = 0x02 Store byte = 0x04 FindNode byte = 0x0B )
View Source
const ( ProtocolHeader byte = 0xE4 SearchResOp byte = 0x3B SearchSrcReqOp byte = 0x34 TagTypeString byte = 0x02 TagTypeUint32 byte = 0x03 TagTypeUint16 byte = 0x08 TagTypeUint8 byte = 0x09 TagTypeUint64 byte = 0x0B TagTypeStr1 byte = 0x11 TagEncryption byte = 0xF3 TagBuddyHash byte = 0xF8 TagClientLowID byte = 0xF9 TagServerPort byte = 0xFA TagServerIP byte = 0xFB TagSourceUPort byte = 0xFC TagSourcePort byte = 0xFD TagSourceIP byte = 0xFE TagSourceType byte = 0xFF )
Variables ¶
This section is empty.
Functions ¶
func DistanceCompare ¶
Types ¶
type BootstrapReq ¶
type BootstrapReq struct{}
func (BootstrapReq) Pack ¶
func (BootstrapReq) Pack() ([]byte, error)
type BootstrapRes ¶
func (BootstrapRes) Pack ¶
func (b BootstrapRes) Pack() ([]byte, error)
func (*BootstrapRes) Unpack ¶
func (b *BootstrapRes) Unpack(payload []byte) error
type CallbackReq ¶
type CallbackReq struct{}
func (CallbackReq) Pack ¶
func (CallbackReq) Pack() ([]byte, error)
type EmptyPacket ¶
type EmptyPacket struct {
Opcode byte
}
func (EmptyPacket) Pack ¶
func (e EmptyPacket) Pack() ([]byte, error)
type FindBuddyReq ¶
type FindBuddyReq struct{}
func (FindBuddyReq) Pack ¶
func (FindBuddyReq) Pack() ([]byte, error)
type FindBuddyRes ¶
type FindBuddyRes struct{}
func (FindBuddyRes) Pack ¶
func (FindBuddyRes) Pack() ([]byte, error)
type FirewalledReq ¶
func (FirewalledReq) Pack ¶
func (f FirewalledReq) Pack() ([]byte, error)
func (*FirewalledReq) Unpack ¶
func (f *FirewalledReq) Unpack(payload []byte) error
type FirewalledRes ¶
type FirewalledRes struct {
IP uint32
}
func (FirewalledRes) Pack ¶
func (f FirewalledRes) Pack() ([]byte, error)
func (*FirewalledRes) Unpack ¶
func (f *FirewalledRes) Unpack(payload []byte) error
type FirewalledUDP ¶
func (FirewalledUDP) Pack ¶
func (f FirewalledUDP) Pack() ([]byte, error)
func (*FirewalledUDP) Unpack ¶
func (f *FirewalledUDP) Unpack(payload []byte) error
type HelloResAck ¶
type HelloResAck struct{}
func (HelloResAck) Pack ¶
func (HelloResAck) Pack() ([]byte, error)
type LegacyFirewalledReq ¶
type LegacyFirewalledReq struct {
TCPPort uint16
}
func (LegacyFirewalledReq) Pack ¶
func (f LegacyFirewalledReq) Pack() ([]byte, error)
func (*LegacyFirewalledReq) Unpack ¶
func (f *LegacyFirewalledReq) Unpack(payload []byte) error
type PacketCombiner ¶
type PacketCombiner struct{}
type PublishKeysReq ¶
type PublishKeysReq struct {
KeywordID ID
Sources []SearchEntry
}
func (PublishKeysReq) Pack ¶
func (p PublishKeysReq) Pack() ([]byte, error)
func (*PublishKeysReq) Unpack ¶
func (p *PublishKeysReq) Unpack(payload []byte) error
type PublishNotesReq ¶
type PublishNotesReq struct {
FileID ID
Notes []SearchEntry
}
func (PublishNotesReq) Pack ¶
func (p PublishNotesReq) Pack() ([]byte, error)
func (*PublishNotesReq) Unpack ¶
func (p *PublishNotesReq) Unpack(payload []byte) error
type PublishNotesRes ¶
type PublishNotesRes struct {
PublishRes
}
func (PublishNotesRes) Pack ¶
func (p PublishNotesRes) Pack() ([]byte, error)
type PublishRes ¶
func (PublishRes) Pack ¶
func (p PublishRes) Pack() ([]byte, error)
func (*PublishRes) Unpack ¶
func (p *PublishRes) Unpack(payload []byte) error
type PublishResAck ¶
type PublishResAck struct{}
func (PublishResAck) Pack ¶
func (PublishResAck) Pack() ([]byte, error)
type PublishSourcesReq ¶
type PublishSourcesReq struct {
FileID ID
Source SearchEntry
}
func (PublishSourcesReq) Pack ¶
func (p PublishSourcesReq) Pack() ([]byte, error)
func (*PublishSourcesReq) Unpack ¶
func (p *PublishSourcesReq) Unpack(payload []byte) error
type SearchEntry ¶
func (SearchEntry) SourceEndpoint ¶
func (s SearchEntry) SourceEndpoint() (protocol.Endpoint, bool)
type SearchKeysReq ¶
func (SearchKeysReq) Pack ¶
func (s SearchKeysReq) Pack() ([]byte, error)
func (*SearchKeysReq) Unpack ¶
func (s *SearchKeysReq) Unpack(payload []byte) error
type SearchNotesReq ¶
func (SearchNotesReq) Pack ¶
func (s SearchNotesReq) Pack() ([]byte, error)
func (*SearchNotesReq) Unpack ¶
func (s *SearchNotesReq) Unpack(payload []byte) error
type SearchNotesRes ¶
type SearchNotesRes struct{}
func (SearchNotesRes) Pack ¶
func (SearchNotesRes) Pack() ([]byte, error)
type SearchRes ¶
type SearchRes struct {
Source ID
Target ID
Results []SearchEntry
}
type SearchSourcesReq ¶
func (SearchSourcesReq) Pack ¶
func (s SearchSourcesReq) Pack() ([]byte, error)
func (*SearchSourcesReq) Unpack ¶
func (s *SearchSourcesReq) Unpack(payload []byte) error
Click to show internal directories.
Click to hide internal directories.