Documentation ¶
Index ¶
- type DeviceMock
- func (d *DeviceMock) ContactsContainer() device.ContactsContainer
- func (d *DeviceMock) CryptoRand() io.Reader
- func (d *DeviceMock) Delay(action func(), duration time.Duration)
- func (d *DeviceMock) ExecuteNextDelayAction()
- func (d *DeviceMock) Log(message string)
- func (d *DeviceMock) MaxPacketSize(address device.DeviceAddress) (int, error)
- func (d *DeviceMock) MessageDelivered(messageID device.MessageID)
- func (d *DeviceMock) Now() time.Time
- func (d *DeviceMock) PopLastPacket() []byte
- func (d *DeviceMock) ProcessMessage(session device.SessionID, message []byte)
- func (d *DeviceMock) Rand() *rand.Rand
- func (d *DeviceMock) ReplyPayload(session device.SessionID, contact device.ContactID) []byte
- func (d *DeviceMock) SendPacket(address device.DeviceAddress, packet []byte)
- func (d *DeviceMock) SessionBroken(session device.SessionID)
- func (d *DeviceMock) SessionEstablished(session device.SessionID, contact device.ContactID, ...)
- func (d *DeviceMock) SyncStateChanged(contact device.ContactID, stateUpdate []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceMock ¶
type DeviceMock struct { Contacts *device.MemoryContactsContainer PacketsSent [][]byte PacketsReceived []device.MessageID MessagesReceived [][]byte Sessions []device.SessionID SessionsEstablished int SessionsBroken int DelayActions []func() SyncState map[device.ContactID][]byte // contains filtered or unexported fields }
func NewDeviceMock ¶
func NewDeviceMock(t testing.TB, random *rand.Rand) *DeviceMock
func (*DeviceMock) ContactsContainer ¶
func (d *DeviceMock) ContactsContainer() device.ContactsContainer
ContactsContainer implements device.Device.
func (*DeviceMock) CryptoRand ¶
func (d *DeviceMock) CryptoRand() io.Reader
CryptoRand implements device.Device.
func (*DeviceMock) Delay ¶
func (d *DeviceMock) Delay(action func(), duration time.Duration)
Delay implements device.Device.
func (*DeviceMock) ExecuteNextDelayAction ¶
func (d *DeviceMock) ExecuteNextDelayAction()
func (*DeviceMock) MaxPacketSize ¶
func (d *DeviceMock) MaxPacketSize(address device.DeviceAddress) (int, error)
MaxPacketSize implements device.Device.
func (*DeviceMock) MessageDelivered ¶
func (d *DeviceMock) MessageDelivered(messageID device.MessageID)
PacketReceived implements device.Device.
func (*DeviceMock) PopLastPacket ¶
func (d *DeviceMock) PopLastPacket() []byte
func (*DeviceMock) ProcessMessage ¶
func (d *DeviceMock) ProcessMessage(session device.SessionID, message []byte)
ProcessMessage implements device.Device.
func (*DeviceMock) ReplyPayload ¶
ReplyPayload implements device.Device.
func (*DeviceMock) SendPacket ¶
func (d *DeviceMock) SendPacket(address device.DeviceAddress, packet []byte)
SendPacket implements device.Device.
func (*DeviceMock) SessionBroken ¶
func (d *DeviceMock) SessionBroken(session device.SessionID)
SessionBroken implements device.Device.
func (*DeviceMock) SessionEstablished ¶
func (d *DeviceMock) SessionEstablished(session device.SessionID, contact device.ContactID, address device.DeviceAddress)
SessionEstablished implements device.Device.
func (*DeviceMock) SyncStateChanged ¶
func (d *DeviceMock) SyncStateChanged(contact device.ContactID, stateUpdate []byte)
SyncStateChanged implements device.Device.
Click to show internal directories.
Click to hide internal directories.