Skip to content

sjafferali/pfsense-api-goclient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.