json

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package json encodes AS topology information via JSON. All types exposed by this package are designed to be directly marshaled to / unmarshaled from JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute string

Attribute indicates the capability of a primary AS.

const (
	// AttrCore indicates a core AS.
	AttrCore Attribute = "core"
)

func (*Attribute) UnmarshalText

func (t *Attribute) UnmarshalText(b []byte) error

UnmarshalText checks that the attribute is valid. It can only be "core"; Deprecated values "authoritative", "issuing", or "voting" are ignored.

type Attributes added in v0.9.0

type Attributes []Attribute

func (*Attributes) UnmarshalJSON added in v0.9.0

func (as *Attributes) UnmarshalJSON(b []byte) error

type BFD

type BFD struct {
	Disable               *bool        `json:"disable,omitempty"`
	DetectMult            uint8        `json:"detect_mult,omitempty"`
	DesiredMinTxInterval  util.DurWrap `json:"desired_min_tx_interval,omitempty"`
	RequiredMinRxInterval util.DurWrap `json:"required_min_rx_interval,omitempty"`
}

BFD configuration.

type BRInfo

type BRInfo struct {
	InternalAddr string                    `json:"internal_addr"`
	Interfaces   map[iface.ID]*BRInterface `json:"interfaces"`
}

BRInfo contains Border Router specific information.

func (BRInfo) String

func (i BRInfo) String() string

type BRInterface

type BRInterface struct {
	Underlay   Underlay `json:"underlay,omitempty"`
	IA         string   `json:"isd_as"`
	LinkTo     string   `json:"link_to"`
	MTU        int      `json:"mtu"`
	BFD        *BFD     `json:"bfd,omitempty"`
	RemoteIfID iface.ID `json:"remote_interface_id,omitempty"`
}

BRInterface contains the information for an data-plane BR socket that is external (i.e., facing the neighboring AS).

type GatewayInfo

type GatewayInfo struct {
	CtrlAddr   string   `json:"ctrl_addr"`
	DataAddr   string   `json:"data_addr"`
	ProbeAddr  string   `json:"probe_addr,omitempty"`
	Interfaces []uint64 `json:"allow_interfaces,omitempty"`
}

GatewayInfo contains SCION gateway information.

type ServerInfo

type ServerInfo struct {
	Addr string `json:"addr"`
}

ServerInfo contains the information for a SCION application running in the local AS.

func (ServerInfo) String

func (i ServerInfo) String() string

type Topology

type Topology struct {
	Timestamp        int64  `json:"timestamp,omitempty"`
	TimestampHuman   string `json:"timestamp_human,omitempty"`
	IA               string `json:"isd_as"`
	MTU              int    `json:"mtu"`
	EndhostPortRange string `json:"dispatched_ports"`
	// Attributes specify whether this is a core AS or not.
	Attributes          Attributes              `json:"attributes"`
	BorderRouters       map[string]*BRInfo      `json:"border_routers,omitempty"`
	ControlService      map[string]*ServerInfo  `json:"control_service,omitempty"`
	DiscoveryService    map[string]*ServerInfo  `json:"discovery_service,omitempty"`
	HiddenSegmentLookup map[string]*ServerInfo  `json:"hidden_segment_lookup_service,omitempty"`
	HiddenSegmentReg    map[string]*ServerInfo  `json:"hidden_segment_registration_service,omitempty"`
	SIG                 map[string]*GatewayInfo `json:"sigs,omitempty"`
}

Topology is the JSON type for the entire AS topology file.

func Load

func Load(b []byte) (*Topology, error)

Load parses a topology from its raw byte representation.

func LoadFromFile

func LoadFromFile(path string) (*Topology, error)

LoadFromFile parses a topology from a file.

type Underlay

type Underlay struct {
	Local            string `json:"local,omitempty"`
	DeprecatedBind   string `json:"bind,omitempty"`   // superseded by "local", for backwards compat
	DeprecatedPublic string `json:"public,omitempty"` // superseded by "local", for backwards compat
	Remote           string `json:"remote,omitempty"`
}

Underlay is the underlay information for a BR interface.

Jump to

Keyboard shortcuts

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