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
- Variables
- func HostLen(htype HostAddrType) (uint8, error)
- func HostTypeCheck(t HostAddrType) bool
- type AS
- type HostAddr
- type HostAddrType
- type HostIPv4
- type HostIPv6
- type HostNone
- type HostSVC
- func (h HostSVC) Base() HostSVC
- func (h HostSVC) BaseString() string
- func (h HostSVC) Copy() HostAddr
- func (h HostSVC) Equal(o HostAddr) bool
- func (h HostSVC) IP() net.IP
- func (h HostSVC) IsMulticast() bool
- func (h HostSVC) Multicast() HostSVC
- func (h HostSVC) Network() string
- func (h HostSVC) Pack() common.RawBytes
- func (h HostSVC) PackWithPad(pad int) []byte
- func (h HostSVC) Size() int
- func (h HostSVC) String() string
- func (h HostSVC) Type() HostAddrType
- type IA
- func (ia IA) Equal(other IA) bool
- func (ia IA) FileFmt(prefixes bool) string
- func (ia IA) IAInt() IAInt
- func (ia IA) IsWildcard() bool
- func (ia IA) IsZero() bool
- func (ia IA) MarshalText() ([]byte, error)
- func (ia *IA) Parse(b common.RawBytes)
- func (ia *IA) Set(s string) error
- func (ia IA) String() string
- func (ia *IA) UnmarshalText(text []byte) error
- func (ia IA) Write(b common.RawBytes)
- type IAInt
- type ISD
Constants ¶
const ( HostLenNone = 0 HostLenIPv4 = net.IPv4len HostLenIPv6 = net.IPv6len HostLenSVC = 2 )
Variables ¶
var ( // ErrBadHostAddrType indicates an invalid host address type. ErrBadHostAddrType = serrors.New("unsupported host address type") // ErrMalformedHostAddrType indicates a malformed host address type. ErrMalformedHostAddrType = serrors.New("malformed host address type") // ErrUnsupportedSVCAddress indicates an unsupported SVC address. ErrUnsupportedSVCAddress = serrors.New("unsupported SVC address") )
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.
func (AS) FileFmt ¶
FileFmt formats an AS for use in a file name, using '_' instead of ':' as the separator for SCION-only AS numbers.
func (AS) MarshalText ¶ added in v0.4.0
func (*AS) UnmarshalText ¶ added in v0.4.0
type HostAddr ¶
type HostAddr interface { Size() int Type() HostAddrType Pack() common.RawBytes IP() net.IP Copy() HostAddr Equal(HostAddr) bool fmt.Stringer }
func HostFromIP ¶
func HostFromIPStr ¶ added in v0.3.1
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) BaseString ¶ added in v0.4.0
BaseString returns the upper case name of the service. For hosts or unrecognized services, it returns UNKNOWN.
func (HostSVC) IsMulticast ¶
func (HostSVC) PackWithPad ¶ added in v0.6.0
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) IsWildcard ¶ added in v0.4.0
IsWildcard returns whether the ia has a wildcard part (isd or as).
func (IA) MarshalText ¶
func (*IA) UnmarshalText ¶
UnmarshalText allows IA to be used as a map key in JSON.
type IAInt ¶
type IAInt uint64
IAInt is an integer representation of an ISD-AS.
func (IAInt) MarshalText ¶ added in v0.6.0
func (*IAInt) UnmarshalText ¶ added in v0.6.0
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.