All Projects → digineo → go-uci

digineo / go-uci

Licence: MIT license
Native Go bindings for OpenWrt's UCI.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-uci

SAGEMCOM-FAST-5370e-TELIA
This is my personal wiki for hacking the router firmware used by (Sagemcom)F@st Version 3.43.2 delivered from Sagemcom
Stars: ✭ 92 (+33.33%)
Mutual labels:  openwrt, uci
Openwisp Config
OpenWRT configuration agent for OpenWISP Controller
Stars: ✭ 375 (+443.48%)
Mutual labels:  openwrt, configuration-management
nodewatcher-agent
A monitoring agent that runs on OpenWrt-supported devices.
Stars: ✭ 14 (-79.71%)
Mutual labels:  openwrt, uci
Openwisp Controller
Network and WiFi controller: provisioning, configuration management and updates, (pull via openwisp-config or push via SSH), x509 PKI management and more. Mainly OpenWRT, but designed to work also on other systems.
Stars: ✭ 377 (+446.38%)
Mutual labels:  openwrt, configuration-management
TG799VAC-XTREME-17.2-MINT
My personal unique wiki for hacking the router firmware used by (Telia)TG799vac Xtream v17.2-MINT delivered from Technicolor
Stars: ✭ 71 (+2.9%)
Mutual labels:  openwrt, uci
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (-17.39%)
Mutual labels:  native, configuration-management
Purec
C backend for PureScript
Stars: ✭ 202 (+192.75%)
Mutual labels:  native
Ts Llvm
TypeScript to LLVM compiler (abandoned)
Stars: ✭ 230 (+233.33%)
Mutual labels:  native
Votlin App
Kotlin multiplatform project
Stars: ✭ 193 (+179.71%)
Mutual labels:  native
You Dont Need Lodash Underscore
List of JavaScript methods which you can use natively + ESLint Plugin
Stars: ✭ 13,915 (+20066.67%)
Mutual labels:  native
Reason Graphql Fullstack
Fullstack Reason + GraphQL Todo List App
Stars: ✭ 246 (+256.52%)
Mutual labels:  native
Enaml Native
Build native mobile apps in python with enaml
Stars: ✭ 234 (+239.13%)
Mutual labels:  native
Elixir Json
Native JSON library for Elixir
Stars: ✭ 216 (+213.04%)
Mutual labels:  native
Expo
An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.
Stars: ✭ 15,550 (+22436.23%)
Mutual labels:  native
Titanium mobile
🚀 Native iOS- and Android- Apps with JavaScript
Stars: ✭ 2,553 (+3600%)
Mutual labels:  native
Httpkit
⚡️ High-level, High-performance HTTP(S) Clients/Servers in Reason/OCaml
Stars: ✭ 198 (+186.96%)
Mutual labels:  native
Core
Native HTML Elements with CSS superpowers. 🕶
Stars: ✭ 237 (+243.48%)
Mutual labels:  native
Ember Native Dom Helpers
Test helpers for your integration tests that fire native events
Stars: ✭ 187 (+171.01%)
Mutual labels:  native
Dmd
dmd D Programming Language compiler
Stars: ✭ 2,498 (+3520.29%)
Mutual labels:  native
Easyincrementalupdate
Android差分补丁库,通过native层合并APK,实现增量更新升级,让你更新的APK更小。
Stars: ✭ 233 (+237.68%)
Mutual labels:  native

go-uci

WORK IN PROGRESS

GoDoc Test results Lint results Codecov

UCI is OpenWrt's Unified Configuration Interface. It is used to configure OpenWrt router hardware using a simple DSL (and acompanying CLI tools). Configuration files are written into a central directory (/etc/config/*) which basically represents a key/value store.

This project makes it easy to interact with such a config tree by providing a native interface to that KV store. It has no external runtime dependencies.

For now, we only implements a superset of the actual UCI DSL, but improvements (patches or PRs) are very welcome. Refer to Rob Pike's Lexical Scanning in Go for implementation details on the parser/lexer.

Why?

We're currently experimenting with Go binaries on OpenWrt router hardware and need a way to interact with the system configuration. We could have created bindings for libuci, but the turnaround cycle in developing with CGO is a bit tedious. Also, since Go does not compile for our target platforms, we need to resort to GCCGO, which has other quirks.

The easiest solution therefore is a plain Go library, which can be used in Go (with or without CGO) and GCCGO without worrying about interoperability. A library also allows UCI to be used outside of OpenWrt systems (e.g. for provisioning).

Usage

import "github.com/digineo/go-uci"

func main() {
    // use the default tree (/etc/config)
    if values, ok := uci.Get("system", "@system[0]", "hostname"); ok {
        fmt.Println("hostanme", values)
        //=> hostname [OpenWrt]
    }

    // use a custom tree
    u := uci.NewTree("/path/to/config")
    if values, ok := u.Get("network", "lan", "ifname"); ok {
        fmt.Println("network.lan.ifname", values)
        //=> network.lan.ifname [eth0.2]
    }
    if sectionExists := u.Set("network", "lan", "ipaddr", "192.168.7.1"); !sectionExists {
        _ = u.AddSection("network", "lan", "interface")
        _ = u.Set("network", "lan", "ipaddr", "192.168.7.1")
    }
    u.Commit() // or uci.Revert()
}

See [API documentation][godoc] for more details.

Contributing

Pull requests are welcome, especially if they increase test coverage.

Before submitting changes, please make sure the tests still pass:

$ go test github.com/digineo/go-uci/...

License

MIT License. Copyright (c) 2019 Dominik Menke, Digineo GmbH

https://www.digineo.de

See LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].