wire

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package wire converts between the SPECTRE service protocol and the domain model, so only the server's API boundary handles protocol messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DivergenceFromMessage

func DivergenceFromMessage(message *pb.Divergence) (model.Divergence, error)

DivergenceFromMessage restores a listed divergence, checking that it identifies its mirror and direction.

func DivergenceMessage

func DivergenceMessage(divergence model.Divergence) *pb.Divergence

DivergenceMessage returns the message that reports divergence.

func FilterFromMessage

func FilterFromMessage(request *pb.ListDivergencesRequest) model.DivergenceFilter

FilterFromMessage restores the filter of a list request.

func FilterMessage

func FilterMessage(filter model.DivergenceFilter) *pb.ListDivergencesRequest

FilterMessage returns the request that lists what filter selects.

func ListFromResponse added in v0.47.0

func ListFromResponse(response *pb.ListDivergencesResponse) ([]model.State, []model.Divergence, error)

ListFromResponse restores the states and divergences of a list response.

func ListJSON added in v0.47.0

func ListJSON(states []model.State, divergences []model.Divergence) ([]byte, error)

ListJSON returns states and divergences as the protocol's JSON list response, which is what the command line prints.

func ListResponse added in v0.47.0

func ListResponse(states []model.State, divergences []model.Divergence) *pb.ListDivergencesResponse

ListResponse returns the protocol's list response for states and divergences.

func QuarantineFromMessage added in v0.48.0

func QuarantineFromMessage(message *pb.Quarantine) (model.Direction, model.Quarantine, error)

QuarantineFromMessage restores a reported quarantine and the direction of the proxy that holds it.

func QuarantineMessage added in v0.48.0

func QuarantineMessage(direction model.Direction, status model.Quarantine) *pb.Quarantine

QuarantineMessage returns the message that reports the quarantine of the proxy in direction.

func StateFromMessage added in v0.47.0

func StateFromMessage(message *pb.State) (model.State, error)

StateFromMessage restores a reported state, checking that it identifies its mirror and holds at most one quarantine per direction.

func StateMessage added in v0.47.0

func StateMessage(state model.State) *pb.State

StateMessage returns the message that reports state.

func UpdateFromMessage added in v0.48.0

func UpdateFromMessage(message *pb.UpdateRequest) (model.Update, error)

UpdateFromMessage restores a streamed update. A keepalive holds none.

func UpdateMessage added in v0.48.0

func UpdateMessage(update model.Update) *pb.UpdateRequest

UpdateMessage returns the message that streams update.

Types

This section is empty.

Jump to

Keyboard shortcuts

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