Golang client for GR241AG router
Usage
package main
import "codeberg.org/tiagosimao/go-gr241ag/pkg/gr241ag"
func main() {
client := gr241ag.Client{
Address: "192.168.1.254",
Port: 22,
Username: "meo",
Password: "meo",
}
_, err := client.Nat().
VirtualServers().
Create(gr241ag.VirtualServer{
ServerName: "testserver",
Protocol: gr241ag.TCP,
ExternalPortStart: 1337,
InternalPortStart: 1337,
ServerIpAddress: "192.168.1.127",
WanInterface: "veip0.1",
})
if err != nil {
panic(err)
}
}
Testing
To test this program/library, create a .env
file at the project root with the following contents
export TEST_GR241AG_ADDRESS=192.168.1.254
export TEST_GR241AG_PORT=22
export TEST_GR241AG_USER=meo
export TEST_GR241AG_PASS=meo
You need a real GR241AG router and the tests do actual changes to it