Watch
1
0
Fork
You've already forked golang-github-tailscale-tailscale-client-go-v2
0
No description
  • Go 98.9%
  • Shell 1.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Baumann 1e8814dd74
Adding debian version 2.10.2-1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2026-10-04 07:30:35 +02:00
.github Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
debian Adding debian version 2.10.2-1. 2026-10-04 07:30:35 +02:00
scripts Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
testdata Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
.goreleaser.yml Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
client.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
client_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
contacts.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
contacts_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
device_posture.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
device_posture_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
devices.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
devices_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
dns.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
dns_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
go.mod Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
go.sum Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
identityfederation.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
identityfederation_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
keys.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
keys_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
LICENSE Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
logging.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
logging_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
oauth.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
policyfile.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
policyfile_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
README.md Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
services.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
services_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
tailnet.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
tailnet_settings.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
tailnet_settings_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
tailnet_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
tailscale_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
users.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
users_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
webhooks.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00
webhooks_test.go Adding upstream version 2.10.2. 2026-10-04 07:30:30 +02:00

tailscale.com/client/tailscale/v2

Go Reference Github Actions

The official client implementation for the Tailscale HTTP API. For more details, please see API documentation.

Example (Using API Key)

package main

import (
	"context"
	"os"

	"tailscale.com/client/tailscale/v2"
)

func main() {
	client := &tailscale.Client{
		Tailnet: os.Getenv("TAILSCALE_TAILNET"),
		APIKey:  os.Getenv("TAILSCALE_API_KEY"),
	}

	devices, err := client.Devices().List(context.Background())
}

Example (Using OAuth)

package main

import (
	"context"
	"os"

	"tailscale.com/client/tailscale/v2"
)

func main() {
	client := &tailscale.Client{
		Tailnet: os.Getenv("TAILSCALE_TAILNET"),
		Auth: &tailscale.OAuth{
			ClientID:     os.Getenv("TAILSCALE_OAUTH_CLIENT_ID"),
			ClientSecret: os.Getenv("TAILSCALE_OAUTH_CLIENT_SECRET"),
			Scopes:       []string{"all:write"},
		},
	}
	
	devices, err := client.Devices().List(context.Background())
}

Example (Using Identity Federation)

package main

import (
	"context"
	"os"

	"tailscale.com/client/tailscale/v2"
)

func main() {
	client := &tailscale.Client{
		Tailnet: os.Getenv("TAILSCALE_TAILNET"),
		Auth: &tailscale.IdentityFederation{
			ClientID: os.Getenv("TAILSCALE_OAUTH_CLIENT_ID"),
			IDTokenFunc: func() (string, error) {
				return os.Getenv("IDENTITY_TOKEN"), nil
            },
		},
	}

	devices, err := client.Devices().List(context.Background())
}

Example (Using Your Own Authentication Mechanism)

package main

import (
	"context"
	"os"

	"tailscale.com/client/tailscale/v2"
)

type MyAuth struct {...}

func (a *MyAuth) HTTPClient(orig *http.Client, baseURL string) *http.Client {
	// build an HTTP client that adds authentication to outgoing requests
	// see tailscale.OAuth for an example.
}

func main() {
	client := &tailscale.Client{
		Tailnet: os.Getenv("TAILSCALE_TAILNET"),
		Auth: &MyAuth{...},
	}
	
	devices, err := client.Devices().List(context.Background())
}

Releasing

Pushing a tag of the format vX.Y.Z will trigger the release workflow which uses goreleaser to build and sign artifacts and generate a GitHub release.