Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

tailhelp

A simple Go package that provides helper functions for working with Tailscale's API.

Installation

go get github.com/strombergdev/tailhelp

Usage

package main
import (
"log""github.com/strombergdev/tailhelp"
)
funcmain() {
// Get your Tailscale IPv4 addressip, err:=tailhelp.MyIP()
iferr!=nil {
log.Fatal(err)
}
log.Printf("My Tailscale IP: %v", ip)
// Find online peers with a specific hostname prefixpeers, err:=tailhelp.PeersFromHostnamePrefix("myprefix", true)
iferr!=nil {
log.Fatal(err)
}
log.Printf("Found peer DNS names: %v", peers)
// Find IPv4 addresses of online peers with a specific hostname prefixips, err:=tailhelp.PeerIPv4sFromHostnamePrefix("myprefix", true)
iferr!=nil {
log.Fatal(err)
}
log.Printf("Found peer IPs: %v", ips)
}

Functions

  • MyIP() (netip.Addr, error): Returns the first IPv4 address of your Tailscale node
  • PeersFromHostnamePrefix(hostname string, onlyOnline bool) ([]string, error): Returns a list of peer DNS names that match the given hostname prefix
  • PeerIPv4sFromHostnamePrefix(hostname string, onlyOnline bool) ([]netip.Addr, error): Returns a list of IPv4 addresses for peers that match the given hostname prefix

Requirements

  • Go 1.19 or later
  • Tailscale daemon running on the system

Release Process

To create and publish a new release:

  1. Create and push a new tag:
git tag v0.0.1
git push origin v0.0.1 --tags
  1. Update your project to use the new version:
go get github.com/strombergdev/tailhelp@v0.0.1
go mod tidy

About

Helper functions to get your Tailscale IP and your peers

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages