oonirelay

package
v0.0.0-...-7328bb5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package oonirelay implements a relay collector that submits sanitized measurements to the OONI Public Collector.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SubmitMeasurement

func SubmitMeasurement(mm *model.Measurement) error

SubmitMeasurement takes a model.Measurement and submits a report to OONI.

Types

type OONIMeasurement

type OONIMeasurement struct {
	Format  string          `json:"format"`
	Content measurementBody `json:"content"`
}

type ReportRequest

type ReportRequest struct {
	DataFormatVersion string `json:"data_format_version"`
	Format            string `json:"format"`
	ProbeASN          string `json:"probe_asn"`
	ProbeCC           string `json:"probe_cc"`
	SoftwareName      string `json:"software_name"`
	SoftwareVersion   string `json:"software_version"`
	TestName          string `json:"test_name"`
	TestStartTime     string `json:"test_start_time"`
	TestVersion       string `json:"test_version"`
}

func NewReportRequest

func NewReportRequest() *ReportRequest

NewReportRequest returns a new ReportRequest object.

func (*ReportRequest) JSON

func (rr *ReportRequest) JSON() ([]byte, error)

type ReportSubmitter

type ReportSubmitter struct {
	API      string
	ReportID string
	Client   *http.Client
}

func NewReportSubmitter

func NewReportSubmitter() *ReportSubmitter

func (*ReportSubmitter) Close

func (rs *ReportSubmitter) Close() error

Close sends the closing request for this report channel.

func (*ReportSubmitter) SendMeasurement

func (rs *ReportSubmitter) SendMeasurement(m *OONIMeasurement) (string, error)

SendMeasurement tries to send the passed OONIMeasurement. Returns the measurement ID and any error.

func (*ReportSubmitter) Start

func (rs *ReportSubmitter) Start(data []byte) error

Start establishes the report channel, and sets the Report ID after a successful acknowledgement.

Jump to

Keyboard shortcuts

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