Documentation ¶
Overview ¶
Package addr contains types for SCION addressing.
A SCION address is composed of the following parts: ISD (ISolation Domain identifier), AS (Autonomous System idenifier), and Host (the host address).
The allocations and formatting of ISDs and ASes are documented here: https://github.com/scionproto/scion/wiki/ISD-and-AS-numbering. Note that the ':' separator for AS formatting is not used in paths/filenames for compatibility reasons, so '_' is used instead in those contexts.
Index ¶
- Constants
- func HostLen(htype HostAddrType) (uint8, error)
- func HostTypeCheck(t HostAddrType) bool
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- type AS
- type AppAddr
- type HostAddr
- type HostAddrType
- type HostIPv4
- type HostIPv6
- type HostNone
- type HostSVC
- func (h HostSVC) Base() HostSVC
- func (h HostSVC) Copy() HostAddr
- func (h HostSVC) Eq(o HostAddr) bool
- func (h HostSVC) IP() net.IP
- func (h HostSVC) IsMulticast() bool
- func (h HostSVC) Multicast() HostSVC
- func (h HostSVC) Pack() common.RawBytes
- func (h HostSVC) Size() int
- func (h HostSVC) String() string
- func (h HostSVC) Type() HostAddrType
- type IA
- func (ia IA) Eq(other IA) bool
- func (ia IA) FileFmt(prefixes bool) string
- func (ia IA) IAInt() IAInt
- func (ia IA) IsZero() bool
- func (ia IA) MarshalText() ([]byte, error)
- func (ia *IA) Parse(b common.RawBytes)
- func (ia IA) String() string
- func (ia *IA) UnmarshalText(text []byte) error
- func (ia IA) Write(b common.RawBytes)
- type IAInt
- type ISD
- type L4Info
Constants ¶
const ( HostLenNone = 0 HostLenIPv4 = net.IPv4len HostLenIPv6 = net.IPv6len HostLenSVC = 2 )
const ( IABytes = 8 ISDBits = 16 ASBits = 48 BGPASBits = 32 MaxISD = (1 << ISDBits) - 1 MaxAS = (1 << ASBits) - 1 MaxBGPAS = (1 << BGPASBits) - 1 ISDFmtPrefix = "ISD" ASFmtPrefix = "AS" )
const (
ErrorBadHostAddrType = "Unsupported host address type"
)
const SVCMcast = 0x8000
Variables ¶
This section is empty.
Functions ¶
func HostLen ¶
func HostLen(htype HostAddrType) (uint8, error)
func HostTypeCheck ¶
func HostTypeCheck(t HostAddrType) bool
Types ¶
type AS ¶
type AS uint64
AS is the Autonomous System idenifier. See formatting and allocations here: https://github.com/scionproto/scion/wiki/ISD-and-AS-numbering#as-numbers
func ASFromFileFmt ¶
ASFromFileFmt parses an AS from a file-format string. This is the same format as ASFromString expects, with ':' replaced by '_'. If prefix is true, an 'AS' prefix is expected and stripped before parsing.
func ASFromString ¶
ASFromString parses an AS from a decimal (in the case of the 32bit BGP AS number space) or ipv6-style hex (in the case of SCION-only AS numbers) string.
type AppAddr ¶ added in v0.2.0
func NewSVCUDPAppAddr ¶ added in v0.2.0
type HostAddr ¶
type HostAddr interface { Size() int Type() HostAddrType Pack() common.RawBytes IP() net.IP Copy() HostAddr Eq(HostAddr) bool fmt.Stringer }
func HostFromIP ¶
func HostFromRaw ¶
func HostFromRaw(b common.RawBytes, htype HostAddrType) (HostAddr, error)
type HostAddrType ¶
type HostAddrType uint8
const ( HostTypeNone HostAddrType = iota HostTypeIPv4 HostTypeIPv6 HostTypeSVC )
func (HostAddrType) String ¶
func (t HostAddrType) String() string
type HostSVC ¶
type HostSVC uint16
func HostSVCFromString ¶
HostSVCFromString returns the SVC address corresponding to str. For anycast SVC addresses, use BS_A, PS_A, CS_A, and SB_A; shorthand versions without the _A suffix (e.g., PS) also return anycast SVC addresses. For multicast, use BS_M, PS_M, CS_M, and SB_M.
func (HostSVC) IsMulticast ¶
func (HostSVC) Type ¶
func (h HostSVC) Type() HostAddrType
type IA ¶
IA represents the ISD (ISolation Domain) and AS (Autonomous System) Id of a given SCION AS.
func IAFromFileFmt ¶
IAFromFileFmt parses an IA from a file-format
func IAFromString ¶
/ IAFromString parses an IA from a string of the format 'ia-as'.
func (IA) FileFmt ¶
FileFmt returns a file-system friendly representation of ia. If prefixes is true, the format will be in the form of ISD%d-AS%d. If it is false, the format is just %d-%d.
func (IA) MarshalText ¶
func (*IA) UnmarshalText ¶
allows IA to be used as a map key in JSON.
type ISD ¶
type ISD uint16
ISD is the ISolation Domain identifier. See formatting and allocations here: https://github.com/scionproto/scion/wiki/ISD-and-AS-numbering#isd-numbers
func ISDFromFileFmt ¶
ISDFromFileFmt parses an ISD from a file-format string. If prefix is true, an 'ISD' prefix is expected and stripped before parsing.
func ISDFromString ¶
ISDFromString parses an ISD from a decimal string.
type L4Info ¶ added in v0.2.0
type L4Info interface { Size() int Type() common.L4ProtocolType Port() uint16 Copy() L4Info Eq(L4Info) bool String() string }
func NewL4SCMPInfo ¶ added in v0.2.0
func NewL4SCMPInfo() L4Info