dash

package module
v0.0.0-...-8633a84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2018 License: Apache-2.0 Imports: 6 Imported by: 1

README

Go library for tracking Amazon Dash buttons

This simple library sniffs on the network for ARP packets sent by a Amazon Dash button.

Usage:


import "github.com/rhuss/dash"

iface, err := net.InterfaceByName("eth0")
if err != nil {
  panic(err)
}

eventChannel := dash.WatchButton(iface, "ac:63:11:22:33:44")
  for {
	select {
	case <- *eventChannel:
		log.Print("Button pressed !")
	}
}

You should ensure that you add an outbound firewall rule to forbid the button to contact Amazon, otherwise you might end up to eat your dog's food delivered by Amazon yourself ;-)

The single dependency for this package is on google/gopacket which is a wrapper around pcap. So cross compiling might become difficult, although this library is perfectly suited to be used as part of an home automation system e.g. by running it on a RaspberryPi.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WatchButton

func WatchButton(iface *net.Interface, macAddress string) *chan ButtonEvent

Types

type ButtonEvent

type ButtonEvent struct {
	MacAddress string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL