A Go library for interacting with OpenWRT routers via the LuCI RPC API.
- LuCI RPC API integration
- SDK to interacte with the Router
go get github.com/renanqts/openwrt-sdk
Here's a basic example of how to use the SDK:
package main
import (
"context"
"log"
"github.com/renanqts/openwrt-sdk/pkg/sdk"
)
func main() {
// Create a new OpenWRT client
client, err := sdk.New(
"https://192.168.1.1", // Router address
"admin", // Username
"password", // Password
1, // RPC ID
false, // Skip TLS verification
)
if err != nil {
log.Fatal(err)
}
// Use the client to interact with the router
}Requirements
- Go 1.24.2 or higher
- golangci-lint for code quality checks
The project includes mock implementations generated using mockgen. To run tests:
go test ./...To generate mocks:
go install go.uber.org/mock/mockgen@latest
go test ./...- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- OpenWRT project for their excellent router firmware
- LuCI team for the RPC API
