mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: fixing windows compilation
This commit is contained in:
parent
c50ebf9991
commit
82389bb4b9
3 changed files with 54 additions and 1 deletions
2
build.sh
2
build.sh
|
@ -165,7 +165,7 @@ rm -rf $BUILD_FOLDER
|
|||
mkdir $BUILD_FOLDER
|
||||
cd $BUILD_FOLDER
|
||||
|
||||
build_android_arm bettercap_android_arm_$VERSION
|
||||
# build_android_arm bettercap_android_arm_$VERSION
|
||||
build_linux_amd64 bettercap_linux_amd64_$VERSION
|
||||
build_linux_arm7 bettercap_linux_arm7_$VERSION
|
||||
build_linux_mips bettercap_linux_mips_$VERSION
|
||||
|
|
15
network/ble_device_windows.go
Normal file
15
network/ble_device_windows.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type BLEDevice struct {
|
||||
LastSeen time.Time
|
||||
}
|
||||
|
||||
func NewBLEDevice() *BLEDevice {
|
||||
return &BLEDevice{
|
||||
LastSeen: time.Now(),
|
||||
}
|
||||
}
|
38
network/ble_windows.go
Normal file
38
network/ble_windows.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type BLEDevNewCallback func(dev *BLEDevice)
|
||||
type BLEDevLostCallback func(dev *BLEDevice)
|
||||
|
||||
type BLE struct {
|
||||
devices map[string]*BLEDevice
|
||||
newCb BLEDevNewCallback
|
||||
lostCb BLEDevLostCallback
|
||||
}
|
||||
|
||||
type bleJSON struct {
|
||||
Devices []*BLEDevice `json:"devices"`
|
||||
}
|
||||
|
||||
func NewBLE(newcb BLEDevNewCallback, lostcb BLEDevLostCallback) *BLE {
|
||||
return &BLE{
|
||||
devices: make(map[string]*BLEDevice),
|
||||
newCb: newcb,
|
||||
lostCb: lostcb,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BLE) MarshalJSON() ([]byte, error) {
|
||||
doc := bleJSON{
|
||||
Devices: make([]*BLEDevice, 0),
|
||||
}
|
||||
|
||||
for _, dev := range b.Devices() {
|
||||
doc.Devices = append(doc.Devices, dev)
|
||||
}
|
||||
|
||||
return json.Marshal(doc)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue