Skip to content

NicoFgrx/pihole-api-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pihole-api-go

WIP : pihole-api-go is a go Client for interacting with Pihole by https://pi-hole.net/.

Installation

pihole-api-go is compatible with modern Go releases in module mode, with Go installed:

go get github.com/NicoFgrx/pihole-api-go

will resolve and add the package to the current development module, along with its dependencies.

Alternatively the same can be achieved if you use import in a package:

import "github.com/NicoFgrx/pihole-api-go/api"

and run go get without parameters.

Usage

import pihole "github.com/NicoFgrx/pihole-api-go/api"

Construct a new pihole client, then use the various services on the client to access different parts of the Pihole API. For example:

url := "http://localhost:8080/admin/api.php" // must be http[s]://<IP>:<port>/admin/api.php
key := "xxx" // find the token on the web UI in Settings>API

client := pihole.NewClient(url, key)

// Get all custom dns defined on the pihole
customdns_lst, err := client.GetAllCustomDNS()

You can find more examples in examples folder.

Development

Feel free to contribute according to the CODE_OF_CONDUCT

Setting up the development environment

You can find a docker-compose file in docker_compose folder.

cd docker_compose
docker-compose up

Default credential is example and only web UI port is listening on http://localhost:8080.

License

This library is distributed under the MIT licence found in the LICENSE file.

About

Simple go client for pihole API

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages