legacymodel

package
v3.19.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package legacymodel contains legacy content that used to be in internal/model

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchivalMaybeBinaryData deprecated

type ArchivalMaybeBinaryData struct {
	Value string
}

ArchivalMaybeBinaryData 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.

See https://github.com/ooni/spec/blob/master/data-formats/df-001-httpt.md#maybebinarydata

Deprecated: do not use this type in new code.

Removing this struct is TODO(https://github.com/ooni/probe/issues/2543).

func (ArchivalMaybeBinaryData) MarshalJSON

func (hb ArchivalMaybeBinaryData) MarshalJSON() ([]byte, error)

MarshalJSON marshals a string-like to JSON following the OONI spec that says that UTF-8 content is represented as string and non-UTF-8 content is instead represented using `{"format":"base64","data":"..."}`.

func (*ArchivalMaybeBinaryData) UnmarshalJSON

func (hb *ArchivalMaybeBinaryData) UnmarshalJSON(d []byte) error

UnmarshalJSON is the opposite of MarshalJSON.

Jump to

Keyboard shortcuts

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