Documentation ¶
Index ¶
- func DecodeSessionID(buf []byte) device.SessionID
- func EncodeRREPHeader(reqID RequestID, sessID device.SessionID, ephemeralKey ecdh.PublicKey) []byte
- func EncodeSessionID(session device.SessionID, buf []byte) []byte
- func SessionSecret(container device.ContactsContainer, contact device.ContactID, ephemeral []byte, ...) (device.SharedSecret, error)
- type NetworkLayer
- func (network *NetworkLayer) AllSessions(contact device.ContactID) []device.SessionID
- func (network *NetworkLayer) BroadcastPacket(packet Packet)
- func (network *NetworkLayer) BroadcastPacketExcept(packet Packet, except device.DeviceAddress)
- func (network *NetworkLayer) BroadcastRouteRequest()
- func (network *NetworkLayer) DeleteContact(contact device.ContactID)
- func (network *NetworkLayer) GetSession(sessionID device.SessionID) (*SessionTableEntry, bool)
- func (network *NetworkLayer) NewRREP(reqID RequestID, sessID device.SessionID, sessionSecret []byte, ...) (*RREPPacket, error)
- func (network *NetworkLayer) NewSESSPacket(sessionID device.SessionID, data []byte) (*SESSPacket, error)
- func (network *NetworkLayer) OnConnection(address device.DeviceAddress)
- func (network *NetworkLayer) OnDisconnection(address device.DeviceAddress)
- func (network *NetworkLayer) ReceivePacket(sender device.DeviceAddress, packet []byte) []SessionMessage
- func (network *NetworkLayer) SendData(session device.SessionID, data []byte) error
- func (network *NetworkLayer) SendRouteRequest(address device.DeviceAddress, ttl TTL)
- func (network *NetworkLayer) SessionBroken(sessID device.SessionID, address *device.DeviceAddress)
- func (network *NetworkLayer) SessionEstablished(contact device.ContactID, session device.SessionID, ...)
- type NetworkLayerEvents
- type Packet
- type PacketType
- type PublicKey
- type RERRPacket
- type RREPPacket
- type RREQPacket
- type RequestID
- type RequestTable
- type RequestTableEntry
- type SESSPacket
- type SessionMessage
- type SessionTable
- type SessionTableEntry
- type TTL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeSessionID ¶
func EncodeRREPHeader ¶
func SessionSecret ¶
func SessionSecret(container device.ContactsContainer, contact device.ContactID, ephemeral []byte, remoteEphemeral []byte) (device.SharedSecret, error)
Types ¶
type NetworkLayer ¶
type NetworkLayer struct {
// contains filtered or unexported fields
}
func NewNetworkLayer ¶
func NewNetworkLayer(dev device.Device, events NetworkLayerEvents, options device.ProtocolOptions) *NetworkLayer
func (*NetworkLayer) AllSessions ¶
func (network *NetworkLayer) AllSessions(contact device.ContactID) []device.SessionID
func (*NetworkLayer) BroadcastPacket ¶
func (network *NetworkLayer) BroadcastPacket(packet Packet)
func (*NetworkLayer) BroadcastPacketExcept ¶
func (network *NetworkLayer) BroadcastPacketExcept(packet Packet, except device.DeviceAddress)
func (*NetworkLayer) BroadcastRouteRequest ¶
func (network *NetworkLayer) BroadcastRouteRequest()
func (*NetworkLayer) DeleteContact ¶
func (network *NetworkLayer) DeleteContact(contact device.ContactID)
func (*NetworkLayer) GetSession ¶
func (network *NetworkLayer) GetSession(sessionID device.SessionID) (*SessionTableEntry, bool)
func (*NetworkLayer) NewRREP ¶
func (network *NetworkLayer) NewRREP(reqID RequestID, sessID device.SessionID, sessionSecret []byte, ownEphemeralPublicKey ecdh.PublicKey, payload []byte) (*RREPPacket, error)
func (*NetworkLayer) NewSESSPacket ¶
func (network *NetworkLayer) NewSESSPacket(sessionID device.SessionID, data []byte) (*SESSPacket, error)
func (*NetworkLayer) OnConnection ¶
func (network *NetworkLayer) OnConnection(address device.DeviceAddress)
func (*NetworkLayer) OnDisconnection ¶
func (network *NetworkLayer) OnDisconnection(address device.DeviceAddress)
func (*NetworkLayer) ReceivePacket ¶
func (network *NetworkLayer) ReceivePacket(sender device.DeviceAddress, packet []byte) []SessionMessage
func (*NetworkLayer) SendData ¶
func (network *NetworkLayer) SendData(session device.SessionID, data []byte) error
func (*NetworkLayer) SendRouteRequest ¶
func (network *NetworkLayer) SendRouteRequest(address device.DeviceAddress, ttl TTL)
func (*NetworkLayer) SessionBroken ¶
func (network *NetworkLayer) SessionBroken(sessID device.SessionID, address *device.DeviceAddress)
func (*NetworkLayer) SessionEstablished ¶
func (network *NetworkLayer) SessionEstablished(contact device.ContactID, session device.SessionID, address device.DeviceAddress, payload []byte, isInitiator bool)
type NetworkLayerEvents ¶
type Packet ¶
type Packet interface { EncodePacket() []byte PacketType() PacketType }
func DecodeRoutingPacket ¶
type PacketType ¶
type PacketType int64
const ( RREQ PacketType = 0x01 RREP PacketType = 0x02 SESS PacketType = 0x03 RERR PacketType = 0x04 )
type RERRPacket ¶
func DecodeRERR ¶
func DecodeRERR(buf []byte) (*RERRPacket, error)
func NewRERR ¶
func NewRERR(sessionID device.SessionID) *RERRPacket
func (*RERRPacket) EncodePacket ¶
func (p *RERRPacket) EncodePacket() []byte
func (*RERRPacket) PacketType ¶
func (p *RERRPacket) PacketType() PacketType
type RREPPacket ¶
type RREPPacket struct { RequestID RequestID SessionID device.SessionID EphemeralKey ecdh.PublicKey Nonce []byte // Cipher contains the authentication tag as well as some optional payload Cipher []byte }
func DecodeRREP ¶
func DecodeRREP(buf []byte) (*RREPPacket, error)
func (*RREPPacket) EncodePacket ¶
func (p *RREPPacket) EncodePacket() []byte
func (*RREPPacket) PacketType ¶
func (p *RREPPacket) PacketType() PacketType
type RREQPacket ¶
type RREQPacket struct { RequestID RequestID TTL TTL EphemeralKey ecdh.PublicKey ContactMask contact_bitmap.ContactBitmap }
func DecodeRREQ ¶
func DecodeRREQ(buf []byte) (*RREQPacket, error)
func NewRREQPacket ¶
func NewRREQPacket(reqID RequestID, ttl TTL, ephemeralKey ecdh.PublicKey, contactMap contact_bitmap.ContactBitmap) *RREQPacket
func (*RREQPacket) EncodePacket ¶
func (packet *RREQPacket) EncodePacket() []byte
func (*RREQPacket) PacketType ¶
func (*RREQPacket) PacketType() PacketType
type RequestTable ¶
type RequestTable map[RequestID]*RequestTableEntry
type RequestTableEntry ¶
type RequestTableEntry struct { RequestID RequestID SourceNeighbour *device.DeviceAddress EphemeralPrivateKey *ecdh.PrivateKey }
func NewRequestTableEntry ¶
func NewRequestTableEntry(reqID RequestID, source *device.DeviceAddress, ephemeral *ecdh.PrivateKey) RequestTableEntry
type SESSPacket ¶
func DecodeSESS ¶
func DecodeSESS(buf []byte) (*SESSPacket, error)
func (*SESSPacket) EncodePacket ¶
func (packet *SESSPacket) EncodePacket() []byte
func (*SESSPacket) PacketType ¶
func (*SESSPacket) PacketType() PacketType
type SessionMessage ¶
type SessionMessage struct {
// contains filtered or unexported fields
}
func (*SessionMessage) Data ¶
func (d *SessionMessage) Data() []byte
func (*SessionMessage) SessionID ¶
func (d *SessionMessage) SessionID() device.SessionID
type SessionTable ¶
type SessionTable map[device.SessionID]*SessionTableEntry
type SessionTableEntry ¶
type SessionTableEntry struct { RequestID RequestID SessionID device.SessionID Contact *device.ContactID SourceNeighbour *device.DeviceAddress TargetNeighbour *device.DeviceAddress SessionSecret []byte }
func SessionEntryFromRREP ¶
func SessionEntryFromRREP(random *rand.Rand, contact *device.ContactID, reqEntry RequestTableEntry, rrep RREPPacket, sender *device.DeviceAddress, sessionSecret []byte) SessionTableEntry
func SessionEntryFromRREQ ¶
func SessionEntryFromRREQ(random *rand.Rand, contact *device.ContactID, reqEntry RequestTableEntry, sender *device.DeviceAddress, sessionSecret []byte) SessionTableEntry
func (*SessionTableEntry) EndpointSession ¶
func (s *SessionTableEntry) EndpointSession() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.