submit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package submit builds and validates the anonymous result files that feed the public map (results/AS<asn>/<date>-<id>.json).

A submission contains only: tool version, date (day precision), ASN, provider name, country, coarse region, connection type and per-target verdicts. No IP addresses, hostnames of the user, timings or raw data.

Index

Constants

View Source
const MaxSize = 64 << 10

MaxSize bounds a submission file.

View Source
const Schema = "prosvet.submission/v1"

Schema identifies the submission format.

Variables

View Source
var (
	ErrNoASN = errors.New("the provider (ASN) is unknown: run the scan with network detection or pass --asn")
	ErrVPN   = errors.New("a VPN or proxy seems active: the result would describe the VPN exit, not your provider")
	ErrDemo  = errors.New("demo reports cannot be submitted")
	ErrEmpty = errors.New("the report contains no results")
)

Errors returned by Build.

Functions

func IssueURL

func IssueURL() string

IssueURL is the GitHub form for submitting a result file without git.

func Marshal

func Marshal(s *Submission) ([]byte, error)

Marshal encodes the submission canonically.

func Path

func Path(dir string, s *Submission) string

Path returns the repository path for s, e.g. results/AS12389/2026-10-11-1a2b3c.json.

func Validate

func Validate(data []byte) error

Validate checks a submission file: format, value ranges and privacy (it must not contain anything that looks like an IP address).

func Write

func Write(dir string, s *Submission) (string, error)

Write stores the submission under dir and returns the file path.

Types

type DNSSummary

type DNSSummary struct {
	Findings []string `json:"findings,omitempty"`
}

DNSSummary lists DNS finding kinds.

type Network

type Network struct {
	ASN     int    `json:"asn"`
	ISP     string `json:"isp,omitempty"`
	Country string `json:"country,omitempty"`
	Region  string `json:"region,omitempty"`
	Conn    string `json:"conn"`
}

Network is the anonymised network description.

type Result

type Result struct {
	Target     string           `json:"target"`
	Category   string           `json:"category"`
	Status     model.Status     `json:"status"`
	Kind       model.Kind       `json:"kind"`
	Subtype    string           `json:"subtype,omitempty"`
	Confidence model.Confidence `json:"confidence"`
	Secondary  []model.Kind     `json:"secondary,omitempty"`
	StallKB    float64          `json:"stall_kb,omitempty"`
}

Result is the verdict for one target.

type Submission

type Submission struct {
	Schema    string      `json:"schema"`
	Tool      Tool        `json:"tool"`
	Date      string      `json:"date"`
	Network   Network     `json:"network"`
	Results   []Result    `json:"results"`
	Whitelist *Whitelist  `json:"whitelist,omitempty"`
	DNS       *DNSSummary `json:"dns,omitempty"`
}

Submission is the anonymous result file.

func Build

func Build(rep *model.Report, allowVPN bool) (*Submission, error)

Build converts a report into a submission. allowVPN skips the VPN check.

type Tool

type Tool struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Tool identifies the producer.

type Whitelist

type Whitelist struct {
	Verdict       string `json:"verdict"`
	DomesticOK    int    `json:"domestic_ok"`
	DomesticTotal int    `json:"domestic_total"`
	ForeignOK     int    `json:"foreign_ok"`
	ForeignTotal  int    `json:"foreign_total"`
	Level         string `json:"level,omitempty"`
}

Whitelist is the whitelist-mode summary.

Jump to

Keyboard shortcuts

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