/go-fritzbox

Go library for accessing a FRITZ!Box

Primary LanguageGoMIT LicenseMIT

go-fritzbox#

go-fritzbox is a Go client libary for accessing a FRITZ!Box (>=FRITZ!OS 5.50)

Documentation: GoDoc

Build Status: Build Status

Test Coverage: Coverage Status

go-fritzbox requires Go version 1.1 or greater.

Usage

import "github.com/philippfranke/go-fritzbox/fritzbox

Construct a new FRITZ!Box client, then use auth method in order to log in. For example, to access Fritz!Box as user "Peter":

client := fritzbox.NewClient(nil)
err := client.Auth("Peter", "Passw0rD!")

Access remote FRITZ!Box over SSL

The recommended way to access a FRITZ!Box over SSL is using a valid SSL certificate, but you can always skip validation. See http docs for complete instruction on using http.Client.

url, _ := url.Parse("https://example.com")
// !!! Not recommended !!!
tr := &http.Transport{
  TLSClientConfig: &tls.Config{
    InsecureSkipVerify: true,
  },
}
c := &http.Client{Transport: tr}

client := fritzbox.NewClient(cl)
client.BaseURL = url

// Login
err := client.Auth("Peter", "Passw0rD!")

License

This library is distributed under the MIT-style license found in the LICENSE file.