dashen

package module
v0.0.0-...-6c19488 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2017 License: MIT Imports: 9 Imported by: 0

README

dashen Codeship Status for minodisk/dashen Go Report Card codecov GoDoc MIT License

Listen the Amazon Dash Button is pressed in the intranet.

Usage

go get -u github.com/minodisk/dashen
package main

import (
	"log"

	"github.com/minodisk/dashen"
)

func main() {
	d := dashen.New()
	d.Subscribe("00:00:00:00:00:00", func() {
		log.Println("detected")
	})
	if err := d.Listen(); err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AlreadyListening = errors.New("already listening")
	NotListening     = errors.New("not listening")
	NoWriter         = errors.New("no writer")
)

Functions

func Filter

func Filter(iface pcap.Interface) error

func IsEquals

func IsEquals(i1, i2 interface{}) bool

Types

type Callback

type Callback func()

type Dashen

type Dashen struct {
	Logger          io.Writer
	LoggerVerbose   io.Writer
	MACCallbacksMap MACCallbacksMap
	// contains filtered or unexported fields
}

func New

func New() *Dashen

func (*Dashen) Close

func (d *Dashen) Close() error

func (*Dashen) Listen

func (d *Dashen) Listen() error

func (*Dashen) Log

func (d *Dashen) Log(v ...interface{}) (int, error)

func (*Dashen) LogVerbose

func (d *Dashen) LogVerbose(v ...interface{}) (int, error)

func (*Dashen) Subscribe

func (d *Dashen) Subscribe(mac string, callback Callback)

func (*Dashen) Unsubscribe

func (d *Dashen) Unsubscribe(mac string, callback Callback)

type Logger

type Logger interface {
	Println(v ...interface{})
	Printf(format string, v ...interface{})
}

type MACCallbacksMap

type MACCallbacksMap map[string][]Callback

type Skip

type Skip struct {
	Reason string
}

func (Skip) Error

func (err Skip) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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