Skip to content

erikh/go-ztone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-ztone: a client to the ZeroTier One local configuration socket

go-ztone is for using against your local ZeroTier One instance. You must use the "secret authtoken" described in this document. For the examples specifically, the convention is to use ZEROTIER_ONE_TOKEN on the commandline to assign it into the environment.

package main

import (
	"fmt"
	"os"

	one "github.com/erikh/go-ztone"
)

func main() {
	c := one.NewClient(os.Getenv("ZEROTIER_ONE_TOKEN"))
	networks, err := c.Networks()
	if err != nil {
		panic(err)
	}

	peers, err := c.Peers()
	if err != nil {
		panic(err)
	}

	fmt.Println("Networks w/ MAC:")
	for _, network := range networks {
		fmt.Println(network.ID, network.MAC)
	}

	fmt.Println("Peers w/ Latency:")
	for _, peer := range peers {
		fmt.Println(peer.Address, peer.Latency)
	}
}

Functionality

ztone has a few basic functions, most of them listed here, as well as on the GoDoc.

Example Code

You can see examples in the examples/ directory. There are two:

  • list-things: lists a few different properties and takes no arguments.
  • query-things: takes a network ID and returns a few properties about it.

Author

Erik Hollensbe github@hollensbe.org

License

BSD 3-Clause

About

ZeroTier One local client library for Golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages