rename to toughswitch

This commit is contained in:
2026-01-05 15:47:43 -05:00
parent 38eb2cc352
commit 438d422b53
8 changed files with 31 additions and 35 deletions

View File

@@ -1,6 +1,7 @@
# edgeos
# toughswitch
A Go client library for interacting with Ubiquiti EdgeOS devices (specifically tested with EdgeSwitch XP / ToughSwitch) via their internal REST API.
A Go client library for interacting with Ubiquiti toughswitch devices (specifically tested with
ToughSwitch POE Pro (TS-8-PRO)) via their internal REST API.
**⚠️ Disclaimer: This library is based on reverse-engineered API calls. It is not an official Ubiquiti product and is subject to change if the device firmware changes.**
@@ -19,7 +20,7 @@ A Go client library for interacting with Ubiquiti EdgeOS devices (specifically t
## Installation
```bash
go get gitea.libretechconsulting.com/rmcguire/edgeos-client/pkg/edgeos
go get gitea.libretechconsulting.com/rmcguire/toughswitch-client/pkg/toughswitch
```
## Usage
@@ -35,14 +36,14 @@ import (
"log"
"time"
"gitea.libretechconsulting.com/rmcguire/edgeos-client/pkg/edgeos"
"gitea.libretechconsulting.com/rmcguire/toughswitch-client/pkg/toughswitch"
)
func main() {
ctx := context.Background()
// Configure your device(s)
configs := []edgeos.Config{
configs := []toughswitch.Config{
{
Host: "192.168.1.1",
Username: "ubnt",
@@ -53,7 +54,7 @@ func main() {
}
// Initialize the client
client := edgeos.MustNew(ctx, configs)
client := toughswitch.MustNew(ctx, configs)
// Fetch system information
deviceHost := "192.168.1.1"
@@ -71,9 +72,9 @@ func main() {
}
for _, iface := range ifaces {
fmt.Printf("Interface %s: %s (POE: %s)\n",
iface.Identification.ID,
iface.Status.Speed,
fmt.Printf("Interface %s: %s (POE: %s)\n",
iface.Identification.ID,
iface.Status.Speed,
iface.Port.POE,
)
}
@@ -91,10 +92,10 @@ if err != nil {
for _, stat := range stats {
// Device level stats
fmt.Printf("CPU Usage: %d%%\n", stat.Device.CPU[0].Usage)
// Per-interface stats
for _, iface := range stat.Interfaces {
fmt.Printf("[%s] Rx: %d bps, Tx: %d bps\n",
fmt.Printf("[%s] Rx: %d bps, Tx: %d bps\n",
iface.Name,
iface.Statistics.RxRate,
iface.Statistics.TxRate,
@@ -108,11 +109,11 @@ for _, stat := range stats {
The client is designed to handle multiple devices concurrently.
```go
configs := []edgeos.Config{
configs := []toughswitch.Config{
{Host: "192.168.1.1", ...},
{Host: "192.168.1.2", ...},
}
client := edgeos.MustNew(ctx, configs)
client := toughswitch.MustNew(ctx, configs)
// Get info for all configured devices in parallel
allSystems, err := client.GetAllSystems(ctx)