go-gr241ag

module
v0.0.0-...-ab4974f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2023 License: Unlicense

README

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

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL