A golang package for adding multi-protocol connectivity and multi-os operation functionality to your application's Host objects.
Rig's intention is to be easy to use and extend.
It should be easy to add support for new operating systems and to add new commands to the multi-os support mechanism without breaking go's type checking.
All of the relevant structs have YAML tags and default values to make unmarshaling from YAML configurations as easy as possible.
Currently rig comes with the most common ways to connect to hosts:
The intended way to use rig is to embed the rig.Connection
struct into your own.
Example:
package main
import "github.com/k0sproject/rig"
type host struct {
rig.Connection
}
func main() {
h := host{
connection: rig.Connection{
SSH: &rig.SSH{
Address: 10.0.0.1
}
}
}
if err := h.Connect(); err != nil {
panic(err)
}
output, err := h.ExecOutput("ls -al")
if err != nil {
panic(err)
}
println(output)
}
But of course you can use it directly on it's own too:
package main
import "github.com/k0sproject/rig"
func main() {
h := rig.Connection{
SSH: &rig.SSH{
Address: 10.0.0.1
}
}
if err := h.Connect(); err != nil {
panic(err)
}
}
See more usage examples in the examples/ directory.
Version | Tag | Published |
---|---|---|
v0.4.7 | 5mos ago | |
v0.4.6 | 7mos ago | |
v0.4.5 | 7mos ago | |
v0.4.4 | 9mos ago |