No description
- Go 98.9%
- Shell 1.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .github | ||
| debian | ||
| scripts | ||
| testdata | ||
| .goreleaser.yml | ||
| client.go | ||
| client_test.go | ||
| contacts.go | ||
| contacts_test.go | ||
| device_posture.go | ||
| device_posture_test.go | ||
| devices.go | ||
| devices_test.go | ||
| dns.go | ||
| dns_test.go | ||
| go.mod | ||
| go.sum | ||
| identityfederation.go | ||
| identityfederation_test.go | ||
| keys.go | ||
| keys_test.go | ||
| LICENSE | ||
| logging.go | ||
| logging_test.go | ||
| oauth.go | ||
| policyfile.go | ||
| policyfile_test.go | ||
| README.md | ||
| services.go | ||
| services_test.go | ||
| tailnet.go | ||
| tailnet_settings.go | ||
| tailnet_settings_test.go | ||
| tailnet_test.go | ||
| tailscale_test.go | ||
| users.go | ||
| users_test.go | ||
| webhooks.go | ||
| webhooks_test.go | ||
tailscale.com/client/tailscale/v2
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.