pfsense-api-goclient

module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT

README

pfsense-api-goclient

Go client library to call the pfsense API: https://github.com/jaredhendrickson13/pfsense-api.

GoDoc Go Report Card Unit golangci-lint govulncheck Test Coverage latest version

Usage

Supported Authentication Methods
  • Local Authentication (Username/Password)
  • JWT Authentication
  • Token Authentication
Example (Local Authentication)
package main

import (
	"context"
	"fmt"

	"github.com/sjafferali/pfsense-api-goclient/pfsenseapi"
)

func main() {
	ctx := context.Background()
	client := pfsenseapi.NewClientWithLocalAuth(
		"https://192.168.10.1",
		"admin",
		"adminpassword",
	)

	leases, err := client.DHCP.ListLeases(ctx)
	if err != nil {
		panic(err)
	}

	for _, lease := range leases {
		fmt.Println(lease.Ip)
	}
}

Contributing

PRs welcome.

Directories

Path Synopsis
Package pfsenseapi provides the api client for calling the pfsense api
Package pfsenseapi provides the api client for calling the pfsense api

Jump to

Keyboard shortcuts

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