json

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 7 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 Address

type Address struct {
	Addr   string `json:"Addr"`
	L4Port int    `json:"L4Port"`
}

Address is a standard layer 3 + layer 4 address.

func (Address) String

func (a Address) String() string

type BRInfo

type BRInfo struct {
	InternalAddrs UnderlayAddressMap               `json:"InternalAddrs"`
	CtrlAddr      NATSCIONAddressMap               `json:"CtrlAddr"`
	Interfaces    map[common.IFIDType]*BRInterface `json:"Interfaces"`
}

BRInfo contains Border Router specific information.

func (BRInfo) String

func (i BRInfo) String() string

type BRInterface

type BRInterface struct {
	Underlay       string           `json:"Overlay,omitempty"`
	PublicUnderlay *UnderlayAddress `json:"PublicOverlay,omitempty"`
	BindUnderlay   *L3Address       `json:"BindOverlay,omitempty"`
	RemoteUnderlay *UnderlayAddress `json:"RemoteOverlay,omitempty"`
	Bandwidth      int              `json:"Bandwidth"`
	IA             string           `json:"ISD_AS"`
	LinkTo         string           `json:"LinkTo"`
	MTU            int              `json:"MTU"`
}

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

type FullSCIONAddress

type FullSCIONAddress struct {
	Address
	UnderlayPort int `json:"OverlayPort,omitempty"`
}

FullSCIONAddress describes a server's public SCION address and the associated underlay address. The address can specify a custom underlay port for this socket (note that the JSON serialization uses the old "overlay" term here), although usually this will be the AS default underlay port.

func (FullSCIONAddress) String

func (a FullSCIONAddress) String() string

type L3Address

type L3Address struct {
	Addr string `json:"Addr"`
}

L3Address is a standard layer 3 address.

func (L3Address) String

func (a L3Address) String() string

type NATSCIONAddress

type NATSCIONAddress struct {
	Public FullSCIONAddress `json:"Public"`
	Bind   *Address         `json:"Bind,omitempty"`
}

NATSCIONAddress contains the address information for a single server socket. It is possible for a server to have both a Public SCION address (i.e., globally scoped) and a Bind SCION address (i.e., configured on the local machine). For example, 192.0.2.1 might be the public address, and 10.0.0.1 might the bind address for the same socket. Note that some higher level libraries might not include support for bind addresses.

func (NATSCIONAddress) String

func (a NATSCIONAddress) String() string

type NATSCIONAddressMap

type NATSCIONAddressMap map[string]*NATSCIONAddress

NATSCIONAddressMap maps address types (e.g., "IPv4") to their values.

func (NATSCIONAddressMap) String

func (m NATSCIONAddressMap) String() string

type NATUnderlayAddress

type NATUnderlayAddress struct {
	PublicUnderlay UnderlayAddress `json:"PublicOverlay"`
	BindUnderlay   *L3Address      `json:"BindOverlay,omitempty"`
}

NATUnderlayAddress contains the information for a single underlay (data-plane) socket. It is possible for an application to have both a Public Underlay address (i.e., globally scoped) and a Bind Underlay address (i.e., configured on the local machine). For example, 192.0.2.1 might be the public underlay address, and 10.0.0.1 might be the bind underlay address for the same socket.

func (NATUnderlayAddress) String

func (a NATUnderlayAddress) String() string

type ServerInfo

type ServerInfo struct {
	Addrs NATSCIONAddressMap `json:"Addrs"`
}

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"`
	TimestampHuman string `json:"TimestampHuman"`
	TTL            uint32 `json:"TTL"`
	IA             string `json:"ISD_AS"`
	Overlay        string `json:"Overlay"`
	MTU            int    `json:"MTU"`
	// Attributes are the primary AS attributes as described in
	// https://github.com/scionproto/scion/blob/master/doc/ControlPlanePKI.md#primary-ases
	// We use the []trc.Attribute type so that we don't validate according to
	// trc.Attributes, because that contains a length 0 check which is not
	// suitable for topology.
	Attributes       []trc.Attribute        `json:"Attributes"`
	BorderRouters    map[string]*BRInfo     `json:"BorderRouters,omitempty"`
	ZookeeperService map[int]*Address       `json:"ZookeeperService,omitempty"`
	ControlService   map[string]*ServerInfo `json:"ControlService,omitempty"`
	SIG              map[string]*ServerInfo `json:"SIG,omitempty"`
}

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

func Load

func Load(b common.RawBytes) (*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 UnderlayAddress

type UnderlayAddress struct {
	Addr         string `json:"Addr"`
	UnderlayPort int    `json:"OverlayPort,omitempty"`
}

UnderlayAddress is a standard layer 3 + layer 4 address. This is identical to the other basic address type in this package, except the JSON property names are different.

func (UnderlayAddress) String

func (a UnderlayAddress) String() string

type UnderlayAddressMap

type UnderlayAddressMap map[string]*NATUnderlayAddress

UnderlayAddressMap maps address types (e.g., "UDP/IPv4") to underlay address values.

func (UnderlayAddressMap) String

func (m UnderlayAddressMap) String() string

Jump to

Keyboard shortcuts

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