analytics

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandwidthData

type BandwidthData struct {
	All      int64 `json:"all"`
	Cached   int64 `json:"cached"`
	Uncached int64 `json:"uncached"`
}

BandwidthData contains bandwidth statistics

type CloudflareClient

type CloudflareClient interface {
	RunAPI(method, endpoint, body string) (string, error)
	RunAPIWithContext(ctx context.Context, method, endpoint, body string) (string, error)
	GetAccountID() string
}

CloudflareClient defines the interface for Cloudflare API operations

type PageViewsData

type PageViewsData struct {
	All int64 `json:"all"`
}

PageViewsData contains page view statistics

type QueryAnalysis

type QueryAnalysis struct {
	ResourceType string // traffic, security, performance
	TimePeriod   string // 24h, 7d, 30d
	ZoneName     string
}

QueryAnalysis contains the result of analyzing an analytics query

type QueryOptions

type QueryOptions struct {
	ZoneID   string `json:"zone_id,omitempty"`
	ZoneName string `json:"zone_name,omitempty"`
	Since    string `json:"since,omitempty"` // -1440 for last 24 hours, etc.
	Until    string `json:"until,omitempty"`
}

QueryOptions contains options for analytics queries

type RequestsData

type RequestsData struct {
	All         int64            `json:"all"`
	Cached      int64            `json:"cached"`
	Uncached    int64            `json:"uncached"`
	ContentType map[string]int64 `json:"content_type,omitempty"`
	Country     map[string]int64 `json:"country,omitempty"`
	SSL         SSLStats         `json:"ssl,omitempty"`
	HTTPStatus  map[int]int64    `json:"http_status,omitempty"`
}

RequestsData contains request statistics

type Response

type Response struct {
	Type    ResponseType `json:"type"`
	Result  string       `json:"result,omitempty"`
	Error   error        `json:"error,omitempty"`
	Message string       `json:"message,omitempty"`
}

Response represents the result of an analytics query

type ResponseType

type ResponseType string

ResponseType indicates the type of response

const (
	ResponseTypeResult ResponseType = "result"
	ResponseTypeError  ResponseType = "error"
)

type SSLStats

type SSLStats struct {
	Encrypted   int64 `json:"encrypted"`
	Unencrypted int64 `json:"unencrypted"`
}

SSLStats contains SSL/TLS statistics

type SubAgent

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

SubAgent handles analytics-related operations

func NewSubAgent

func NewSubAgent(client CloudflareClient, debug bool) *SubAgent

NewSubAgent creates a new Analytics sub-agent

func (*SubAgent) HandleQuery

func (s *SubAgent) HandleQuery(ctx context.Context, query string, opts QueryOptions) (*Response, error)

HandleQuery processes analytics-related queries

type ThreatsData

type ThreatsData struct {
	All     int64            `json:"all"`
	Country map[string]int64 `json:"country,omitempty"`
	Type    map[string]int64 `json:"type,omitempty"`
}

ThreatsData contains threat statistics

type UniquesData

type UniquesData struct {
	All int64 `json:"all"`
}

UniquesData contains unique visitor statistics

type ZoneAnalytics

type ZoneAnalytics struct {
	Requests  RequestsData  `json:"requests"`
	Bandwidth BandwidthData `json:"bandwidth"`
	Threats   ThreatsData   `json:"threats"`
	PageViews PageViewsData `json:"pageviews"`
	Uniques   UniquesData   `json:"uniques"`
}

ZoneAnalytics represents analytics data for a zone

Jump to

Keyboard shortcuts

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