misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-02-28 13:41:07 +01:00
commit c92d1ffbe7

View file

@ -3,11 +3,15 @@
package modules package modules
import ( import (
"fmt" "errors"
"github.com/bettercap/bettercap/session" "github.com/bettercap/bettercap/session"
) )
var (
notSupported = errors.New("ble.recon is not supported on this OS")
)
type BLERecon struct { type BLERecon struct {
session.SessionModule session.SessionModule
} }
@ -31,13 +35,13 @@ func NewBLERecon(s *session.Session) *BLERecon {
d.AddHandler(session.NewModuleHandler("ble.recon on", "", d.AddHandler(session.NewModuleHandler("ble.recon on", "",
"Start Bluetooth Low Energy devices discovery.", "Start Bluetooth Low Energy devices discovery.",
func(args []string) error { func(args []string) error {
return fmt.Errorf("ble.recon is not supported on Windows") return notSupported
})) }))
d.AddHandler(session.NewModuleHandler("ble.recon off", "", d.AddHandler(session.NewModuleHandler("ble.recon off", "",
"Stop Bluetooth Low Energy devices discovery.", "Stop Bluetooth Low Energy devices discovery.",
func(args []string) error { func(args []string) error {
return fmt.Errorf("ble.recon is not supported on Windows") return notSupported
})) }))
return d return d
@ -56,13 +60,13 @@ func (d BLERecon) Author() string {
} }
func (d *BLERecon) Configure() (err error) { func (d *BLERecon) Configure() (err error) {
return fmt.Errorf("ble.recon is not supported on Windows and macOS") return notSupported
} }
func (d *BLERecon) Start() error { func (d *BLERecon) Start() error {
return fmt.Errorf("ble.recon is not supported on Windows and macOS") return notSupported
} }
func (d *BLERecon) Stop() error { func (d *BLERecon) Stop() error {
return fmt.Errorf("ble.recon is not supported on Windows and macOS") return notSupported
} }