telemetry

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package telemetry sends anonymous usage signals to TelemetryDeck (Ingest API v2): that Planck was installed and launched, and that a stream started and ended, with its codec and the kind of route it took. A signal never holds a host or device name, an address, a Tailscale identity, a window title, a pairing PIN or key, or anything of the stream itself; the payload keeps only values from the fixed lists below.

The user turns it off in Settings › General. Off stops every signal at once, including queued ones and a send in flight.

Index

Constants

View Source
const (
	TypeInstalled      = "app.installed"
	TypeLaunched       = "app.launched"
	TypeSessionStarted = "session.started"
	TypeSessionEnded   = "session.ended"
)

The signal types.

View Source
const (
	ChannelRelease = "release"
	ChannelDev     = "dev"
)

The build channels: an official release, or any other build.

View Source
const (
	ModeClient = "client"
	ModeHost   = "host"
)

The modes: which side of a stream this process, or a session, is.

View Source
const (
	TransportLAN             = "lan"
	TransportTailscaleDirect = "tailscale_direct"
	TransportTailscaleRelay  = "tailscale_relay"
	TransportUnknown         = unknown
)

The values of a session's transportKind.

View Source
const DefaultEndpoint = "https://nom.telemetrydeck.com/v2/"

DefaultEndpoint is TelemetryDeck's Ingest API v2.

Variables

View Source
var DefaultAppID = ""

DefaultAppID is the TelemetryDeck App ID of the official app. Empty sends nothing. Release builds set it with -ldflags "-X github.com/planckdotgg/planck/internal/telemetry.DefaultAppID=<id>"; PLANCK_TELEMETRY_APP_ID overrides it.

Functions

func ClientUser

func ClientUser(installID string) string

ClientUser is the clientUser of an install: the lowercase hex SHA-256 of its random ID. TelemetryDeck hashes it again, with a salt.

func CodecName

func CodecName(codec string) string

CodecName is codec as one of h264, hevc, av1 or pyrowave, else unknown.

func TransportKind

func TransportKind(path string) string

TransportKind is a path's name, as pkg/ratectl or pkg/discovery give it, as one of the Transport constants.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client queues signals and sends them on its own goroutine. A nil Client sends nothing.

func New

func New(o Options, enabled bool) *Client

New starts a client; enabled is the user's setting.

func (*Client) Active

func (c *Client) Active() bool

Active is true when signals can leave: an App ID is set and the user has telemetry on.

func (*Client) Close

func (c *Client) Close(wait time.Duration)

Close stops the client, giving a queued send up to wait to finish.

func (*Client) Launched

func (c *Client) Launched()

Launched sends app.launched, after app.installed the first time on this install. It sends once per run; while telemetry is off it waits for the next call.

func (*Client) SessionEnded

func (c *Client) SessionEnded(s Session)

SessionEnded sends session.ended.

func (*Client) SessionStarted

func (c *Client) SessionStarted(s Session)

SessionStarted sends session.started.

func (*Client) SetEnabled

func (c *Client) SetEnabled(on bool)

SetEnabled follows the user's setting. Off drops the queue and cancels a send in flight.

type Options

type Options struct {
	AppID    string
	Endpoint string
	TestMode bool
	// StateFile keeps the install ID and whether app.installed was sent.
	StateFile  string
	AppVersion string
	Channel    string
	// Mode is ModeClient or ModeHost: the program that sends.
	Mode string
	HTTP *http.Client
	// RetryAfter is the wait after a failed send; 0 is one minute.
	RetryAfter time.Duration
	// Enabled, if set, reads the user's setting again before each send,
	// shutdown's included; false turns the client off as SetEnabled(false).
	Enabled func() bool
}

Options set up a Client.

func OptionsForThisBuild

func OptionsForThisBuild(configDir, version string, official bool, mode string) Options

OptionsForThisBuild are the options of this build: the App ID, the endpoint, and test mode from the build, overridden by PLANCK_TELEMETRY_APP_ID, PLANCK_TELEMETRY_ENDPOINT and PLANCK_TELEMETRY_TEST_MODE=1. A build that is not official is always in test mode: the variable can only turn test mode on.

type Session

type Session struct {
	Mode      string // ModeClient or ModeHost
	Codec     string // CodecName's input: "HEVC", "h264", "PyroWave"...
	Transport string // TransportKind's input: "lan-direct", "tailscale-derp"...
}

Session is what session.started and session.ended tell of a stream. Unknown values are sent as "unknown", so nothing else can leave.

type Signal

type Signal struct {
	AppID      string            `json:"appID"`
	ClientUser string            `json:"clientUser"`
	SessionID  string            `json:"sessionID"`
	Type       string            `json:"type"`
	IsTestMode bool              `json:"isTestMode"`
	Payload    map[string]string `json:"payload"`
}

Signal is one TelemetryDeck v2 event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL