Documentation
¶
Overview ¶
Package telemetry provides a consent-gated telemetry client that signs event POSTs with the node's Ed25519 identity and sends them to a configured telemetry endpoint. When the consent flag is off (empty URL), the client is a hard no-op: no dial, no buffering, no goroutines.
Index ¶
Constants ¶
const ( HeaderTimestamp = "X-Pilot-Timestamp" HeaderPubKey = "X-Pilot-Public-Key" HeaderSignature = "X-Pilot-Signature" )
Canonical signing header names, matching the telemetry server's internal/sig contract.
const DefaultEndpoint = "https://telemetry.pilotprotocol.network/v1/events"
DefaultEndpoint is the production telemetry ingestion URL.
Variables ¶
This section is empty.
Functions ¶
func SignMessage ¶
func SignMessage(priv ed25519.PrivateKey, body []byte) (ts, pubB64, sigB64 string, err error)
SignMessage implements the signing contract directly, without an HTTP POST. Useful for tests and for components that want to sign arbitrary byte payloads. Returns (timestamp, pubKeyB64, signatureB64, error).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a consent-gated telemetry sender. Zero value is a no-op.
func New ¶
New creates a consent-gated telemetry client. When url is empty the client is a permanent no-op.
func NewClientFromIdentity ¶
NewClientFromIdentity creates a consent-gated telemetry client from an Ed25519 identity file on disk and a telemetry URL. When url is empty the client is a permanent no-op. When the identity file does not exist (first-run grace), Send calls are no-ops until the identity is created.
func (*Client) Send ¶
Send POSTs one or more events to the telemetry endpoint. Returns immediately (no-op) when the client is disabled (no consent) or no signer is configured.
The request is Ed25519-signed with the node's identity, following the telemetry server's signing contract:
- X-Pilot-Timestamp: unix seconds (decimal string)
- X-Pilot-Public-Key: base64(std) of the 32-byte Ed25519 public key
- X-Pilot-Signature: base64(std) of the Ed25519 signature over (timestamp + "\n" + body)
type Event ¶
type Event struct {
EventID string `json:"event_id"`
Kind string `json:"kind"`
TS string `json:"ts"` // RFC3339; empty = server defaults to receive time
NodeID int64 `json:"node_id,omitempty"`
Payload json.RawMessage `json:"payload"`
}
Event is the wire shape sent to the telemetry endpoint.