Documentation ¶
Overview ¶
Package oonidatamodel contains the OONI data model.
The input of this package is data generated by netx and the output is a format consistent with OONI specs.
Deprecated by the archival package.
Index ¶
- Variables
- type DNSAnswerEntry
- type DNSQueriesList
- type DNSQueryEntry
- type ExtSpec
- type HTTPBody
- type HTTPHeader
- type HTTPHeaders
- type HTTPHeadersList
- type HTTPRequest
- type HTTPResponse
- type HTTPTor
- type MaybeBinaryValue
- type NetworkEvent
- type NetworkEventsList
- type RequestEntry
- type RequestList
- type TCPConnectEntry
- type TCPConnectList
- type TCPConnectStatus
- type TLSHandshake
- type TLSHandshakesList
Constants ¶
This section is empty.
Variables ¶
var ( // ExtDNS is the version of df-002-dnst.md ExtDNS = ExtSpec{Name: "dnst", V: 0} // ExtNetevents is the version of df-008-netevents.md ExtNetevents = ExtSpec{Name: "netevents", V: 0} // ExtHTTP is the version of df-001-httpt.md ExtHTTP = ExtSpec{Name: "httpt", V: 0} // ExtTCPConnect is the version of df-005-tcpconnect.md ExtTCPConnect = ExtSpec{Name: "tcpconnect", V: 0} // ExtTLSHandshake is the version of df-006-tlshandshake.md ExtTLSHandshake = ExtSpec{Name: "tlshandshake", V: 0} )
Functions ¶
This section is empty.
Types ¶
type DNSAnswerEntry ¶
type DNSAnswerEntry struct { AnswerType string `json:"answer_type"` Hostname string `json:"hostname,omitempty"` IPv4 string `json:"ipv4,omitempty"` IPv6 string `json:"ipv6,omitempty"` TTL *uint32 `json:"ttl"` }
DNSAnswerEntry is the answer to a DNS query
type DNSQueriesList ¶
type DNSQueriesList []DNSQueryEntry
DNSQueriesList is a list of DNS queries
func NewDNSQueriesList ¶
func NewDNSQueriesList(results oonitemplates.Results) DNSQueriesList
NewDNSQueriesList returns a list of DNS queries.
type DNSQueryEntry ¶
type DNSQueryEntry struct { Answers []DNSAnswerEntry `json:"answers"` DialID int64 `json:"dial_id,omitempty"` Engine string `json:"engine"` Failure *string `json:"failure"` Hostname string `json:"hostname"` QueryType string `json:"query_type"` ResolverHostname *string `json:"resolver_hostname"` ResolverPort *string `json:"resolver_port"` ResolverAddress string `json:"resolver_address"` T float64 `json:"t"` TransactionID int64 `json:"transaction_id,omitempty"` }
DNSQueryEntry is a DNS query with possibly an answer
type ExtSpec ¶
ExtSpec describes a data format extension
func (ExtSpec) AddTo ¶
func (spec ExtSpec) AddTo(m *model.Measurement)
AddTo adds the current ExtSpec to the specified measurement
type HTTPBody ¶
type HTTPBody = MaybeBinaryValue
HTTPBody is an HTTP body. As an implementation note, this type must be an alias for the MaybeBinaryValue type, otherwise the specific serialisation mechanism implemented by MaybeBinaryValue is not working.
type HTTPHeader ¶
type HTTPHeader struct { Key string Value MaybeBinaryValue }
HTTPHeader is a single HTTP header.
func (HTTPHeader) MarshalJSON ¶
func (hh HTTPHeader) MarshalJSON() ([]byte, error)
MarshalJSON marshals a single HTTP header to a tuple where the first element is a string and the second element is maybe-binary data.
func (*HTTPHeader) UnmarshalJSON ¶
func (hh *HTTPHeader) UnmarshalJSON(d []byte) error
UnmarshalJSON is the opposite of MarshalJSON.
type HTTPHeaders ¶
type HTTPHeaders map[string]MaybeBinaryValue
HTTPHeaders contains HTTP headers. This headers representation is deprecated in favour of HTTPHeadersList since data format 0.3.0.
type HTTPRequest ¶
type HTTPRequest struct { Body HTTPBody `json:"body"` BodyIsTruncated bool `json:"body_is_truncated"` HeadersList HTTPHeadersList `json:"headers_list"` Headers HTTPHeaders `json:"headers"` Method string `json:"method"` Tor HTTPTor `json:"tor"` URL string `json:"url"` }
HTTPRequest contains an HTTP request.
Headers are a map in Web Connectivity data format but we have added support for a list since data format version equal to 0.2.1 (later renamed to 0.3.0).
type HTTPResponse ¶
type HTTPResponse struct { Body HTTPBody `json:"body"` BodyIsTruncated bool `json:"body_is_truncated"` Code int64 `json:"code"` HeadersList HTTPHeadersList `json:"headers_list"` Headers HTTPHeaders `json:"headers"` }
HTTPResponse contains an HTTP response.
Headers are a map in Web Connectivity data format but we have added support for a list since data format version equal to 0.2.1 (later renamed to 0.3.0).
type HTTPTor ¶
type HTTPTor struct { ExitIP *string `json:"exit_ip"` ExitName *string `json:"exit_name"` IsTor bool `json:"is_tor"` }
HTTPTor contains Tor information
type MaybeBinaryValue ¶
type MaybeBinaryValue struct {
Value string
}
MaybeBinaryValue is a possibly binary string. We use this helper class to define a custom JSON encoder that allows us to choose the proper representation depending on whether the Value field is valid UTF-8 or not.
func (MaybeBinaryValue) MarshalJSON ¶
func (hb MaybeBinaryValue) MarshalJSON() ([]byte, error)
MarshalJSON marshals a string-like to JSON following the OONI spec that says that UTF-8 content is represened as string and non-UTF-8 content is instead represented using `{"format":"base64","data":"..."}`.
func (*MaybeBinaryValue) UnmarshalJSON ¶
func (hb *MaybeBinaryValue) UnmarshalJSON(d []byte) error
UnmarshalJSON is the opposite of MarshalJSON.
type NetworkEvent ¶
type NetworkEvent struct { Address string `json:"address,omitempty"` ConnID int64 `json:"conn_id,omitempty"` DialID int64 `json:"dial_id,omitempty"` Failure *string `json:"failure"` NumBytes int64 `json:"num_bytes,omitempty"` Operation string `json:"operation"` Proto string `json:"proto"` T float64 `json:"t"` TransactionID int64 `json:"transaction_id,omitempty"` }
NetworkEvent is a network event.
type NetworkEventsList ¶
type NetworkEventsList []*NetworkEvent
NetworkEventsList is a list of network events.
func NewNetworkEventsList ¶
func NewNetworkEventsList(results oonitemplates.Results) NetworkEventsList
NewNetworkEventsList returns a list of DNS queries.
type RequestEntry ¶
type RequestEntry struct { Failure *string `json:"failure"` Request HTTPRequest `json:"request"` Response HTTPResponse `json:"response"` TransactionID int64 `json:"transaction_id,omitempty"` }
RequestEntry is one of the entries that are part of the "requests" key of a OONI report.
type RequestList ¶
type RequestList []RequestEntry
RequestList is a list of RequestEntry
func NewRequestList ¶
func NewRequestList(results oonitemplates.Results) RequestList
NewRequestList returns the list for "requests"
type TCPConnectEntry ¶
type TCPConnectEntry struct { ConnID int64 `json:"conn_id,omitempty"` DialID int64 `json:"dial_id,omitempty"` IP string `json:"ip"` Port int `json:"port"` Status TCPConnectStatus `json:"status"` T float64 `json:"t"` TransactionID int64 `json:"transaction_id,omitempty"` }
TCPConnectEntry contains one of the entries that are part of the "tcp_connect" key of a OONI report.
type TCPConnectList ¶
type TCPConnectList []TCPConnectEntry
TCPConnectList is a list of TCPConnectEntry
func NewTCPConnectList ¶
func NewTCPConnectList(results oonitemplates.Results) TCPConnectList
NewTCPConnectList creates a new TCPConnectList
type TCPConnectStatus ¶
TCPConnectStatus contains the TCP connect status.
type TLSHandshake ¶
type TLSHandshake struct { CipherSuite string `json:"cipher_suite"` ConnID int64 `json:"conn_id,omitempty"` Failure *string `json:"failure"` NegotiatedProtocol string `json:"negotiated_protocol"` PeerCertificates []MaybeBinaryValue `json:"peer_certificates"` T float64 `json:"t"` TLSVersion string `json:"tls_version"` TransactionID int64 `json:"transaction_id,omitempty"` }
TLSHandshake contains TLS handshake data
type TLSHandshakesList ¶
type TLSHandshakesList []TLSHandshake
TLSHandshakesList is a list of TLS handshakes
func NewTLSHandshakesList ¶
func NewTLSHandshakesList(results oonitemplates.Results) TLSHandshakesList
NewTLSHandshakesList creates a new TLSHandshakesList