From 3f0854de8888f3c12639b8a040e9a9a4196140d8 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 9 Jun 2022 21:11:11 +0100 Subject: [PATCH] Test main packages for listing other types of thing --- cmd/bt/main.go | 21 +++++++++++++++++++++ cmd/whois/main.go | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 cmd/bt/main.go create mode 100644 cmd/whois/main.go diff --git a/cmd/bt/main.go b/cmd/bt/main.go new file mode 100644 index 0000000..c1fe447 --- /dev/null +++ b/cmd/bt/main.go @@ -0,0 +1,21 @@ +package main + +import "tinygo.org/x/bluetooth" +import "fmt" + +func main() { + var err error + + var adapter = bluetooth.DefaultAdapter + err = adapter.Enable() + if err != nil { + panic(err) + } + + err = adapter.Scan(func(adapter *bluetooth.Adapter, device bluetooth.ScanResult) { + fmt.Println("found device:", device.Address.String(), device.RSSI, device.LocalName()) + }) + if err != nil { + panic(err) + } +} diff --git a/cmd/whois/main.go b/cmd/whois/main.go new file mode 100644 index 0000000..c755061 --- /dev/null +++ b/cmd/whois/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "context" + "fmt" + + "github.com/domainr/whois" +) + +func main() { + req, err := whois.NewRequest("bcube.co.uk") + if err != nil { + panic(err) + } + w := whois.NewClient(0) + res, err := w.FetchContext(context.TODO(), req) + if err != nil { + panic(err) + } + fmt.Println(res.String()) +}