encoding

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeJSON = "application/json"

ContentTypeJSON holds the HTML content-type of a JSON payload

View Source
const ContentTypeProtobuf = "application/protobuf"

ContentTypeProtobuf holds the HTML content-type of a Protobuf payload

Variables

This section is empty.

Functions

func FormatConnection

func FormatConnection(conn network.ConnectionStats) *model.Connection

FormatConnection converts a ConnectionStats into an model.Connection

func FormatDNS

func FormatDNS(dns map[util.Address][]string) map[string]*model.DNSEntry

FormatDNS converts a map[util.Address][]string to a map using IPs string representation

func FormatTelemetry

FormatTelemetry converts telemetry from its internal representation to a protobuf message

Types

type Marshaler

type Marshaler interface {
	Marshal(conns *network.Connections) ([]byte, error)
	ContentType() string
}

Marshaler is an interface implemented by all Connections serializers

func GetMarshaler

func GetMarshaler(accept string) Marshaler

GetMarshaler returns the appropriate Marshaler based on the given accept header

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]byte) (*model.Connections, error)
}

Unmarshaler is an interface implemented by all Connections deserializers

func GetUnmarshaler

func GetUnmarshaler(ctype string) Unmarshaler

GetUnmarshaler returns the appropriate Unmarshaler based on the given content type

Jump to

Keyboard shortcuts

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