Documentation
¶
Index ¶
- Constants
- type Area
- type AreaAddress
- type AreaConfig
- type Conn
- type Instance
- type InstanceConfig
- type Interface
- type InterfaceConfig
- type InterfaceState
- type InterfaceStateChangingEvent
- type InterfaceType
- type LSDBASExternalItem
- type LSDBNetworkItem
- type LSDBRouterItem
- type LSDBSummaryItem
- type Neighbor
- type NeighborState
- type NeighborStateChangingEvent
- type Router
- type RoutingDestinationType
- type RoutingPathType
- type RoutingTable
- type RoutingTableEntry
- type SPFTree
- type TSS
- type TickerFunc
Constants ¶
View Source
const ( // AllSPFRouters 广播网络上,所有运行 OSPF 的路由器必须准备接收发送到该地址的包. per RFC2328 A.1 AllSPFRouters = "224.0.0.5" // AllDRouters 广播网络上,DR 和 BDR 必须准备接收发送到该地址的包. per RFC2328 A.1 AllDRouters = "224.0.0.6" // IPProtocolNum OSPF申请的IP协议号. per RFC2328 A.1 IPProtocolNum = 89 // IPPacketTos OSPF使用的IP包类别和优先级. per RFC2328 A.1 and RFC791 3.1 IPPacketTos = 0b11000000 // 0xc0 MulticastTTL = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area struct { Options packet.BitOption // A 32-bit number identifying the area. The Area ID of 0.0.0.0 is // reserved for the backbone. AreaId uint32 // List of area address ranges // In order to aggregate routing information at area boundaries, // area address ranges can be employed. Each address range is // specified by an [address,mask] pair and a status indication of // either Advertise or DoNotAdvertise Addresses []*AreaAddress // This router's interfaces connecting to the area. A router // interface belongs to one and only one area (or the backbone). // For the backbone area this list includes all the virtual links. // A virtual link is identified by the Router ID of its other // endpoint; its cost is the cost of the shortest intra-area path // through the Transit area that exists between the two routers. Interfaces []*Interface // A router-LSA is generated by each router in the area. It // describes the state of the router's interfaces to the area. RouterLSAs map[packet.LSAIdentity]*LSDBRouterItem // One network-LSA is generated for each transit broadcast and NBMA // network in the area. A network-LSA describes the set of routers // currently connected to the network. NetworkLSAs map[packet.LSAIdentity]*LSDBNetworkItem // Summary-LSAs originate from the area's area border routers. // They describe routes to destinations internal to the Autonomous // System, yet external to the area (i.e., inter-area // destinations). SummaryLSAs map[packet.LSAIdentity]*LSDBSummaryItem // This parameter indicates whether the area can carry data traffic // that neither originates nor terminates in the area itself. This // parameter is calculated when the area's shortest-path tree is // built (see Section 16.1, where TransitCapability is set to TRUE // if and only if there are one or more fully adjacent virtual // links using the area as Transit area), and is used as an input // to a subsequent step of the routing table build process (see // Section 16.3). When an area's TransitCapability is set to TRUE, // the area is said to be a "transit area". TransitCapability bool // Whether AS-external-LSAs will be flooded into/throughout the // area. This is a configurable parameter. If AS-external-LSAs // are excluded from the area, the area is called a "stub". Within // stub areas, routing to AS external destinations will be based // solely on a default summary route. The backbone cannot be // configured as a stub area. Also, virtual links cannot be // configured through stub areas. For more information, see // Section 3.6. ExternalRoutingCapability bool // If the area has been configured as a stub area, and the router // itself is an area border router, then the StubDefaultCost // indicates the cost of the default summary-LSA that the router // should advertise into the area. See Section 12.4.3 for more // information. StubDefaultCost int // The shortest-path tree for the area, with this router itself as // root. Derived from the collected router-LSAs and network-LSAs // by the Dijkstra algorithm (see Section 16.1). SPF *SPFTree // contains filtered or unexported fields }
func (*Area) AddInterface ¶
func (a *Area) AddInterface(c *InterfaceConfig)
type AreaAddress ¶
type AreaAddress struct { Address *net.IPNet // Routing information is condensed at area boundaries. // External to the area, at most a single route is // advertised (via a summary-LSA) for each address // range. The route is advertised if and only if the // address range's Status is set to Advertise. // Unadvertised ranges allow the existence of certain // networks to be intentionally hidden from other // areas. Status is set to Advertise by default. DoNotAdvertise bool }
type AreaConfig ¶
type AreaConfig struct { Instance *Instance AreaId uint32 Address *AreaAddress Options packet.BitOption }
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func ListenOSPFv2Multicast ¶
func (*Conn) WriteMulticastAllSPF ¶
type Instance ¶
type Instance struct { RouterId uint32 ASBR bool // The OSPF backbone area is responsible for the dissemination of // inter-area routing information. Backbone *Area // Each one of the areas to which the router is connected has its // own data structure. This data structure describes the working // of the basic OSPF algorithm. Remember that each area runs a // separate copy of the basic OSPF algorithm. // Not used yet Areas []*Area // These are routes to destinations external to the Autonomous // System, that have been gained either through direct experience // with another routing protocol (such as BGP), or through // configuration information, or through a combination of the two // (e.g., dynamic external information to be advertised by OSPF // with configured metric). Any router having these external routes // is called an AS boundary router. These routes are advertised by // the router into the OSPF routing domain via AS-external-LSAs. ExternalRoutes *RoutingTable // Part of the link-state database. These have originated from the // AS boundary routers. They comprise routes to destinations // external to the Autonomous System. Note that, if the router is // itself an AS boundary router, some of these AS-external-LSAs // have been self-originated. ASExternalLSAs map[packet.LSAIdentity]*LSDBASExternalItem // Derived from the link-state database. Each entry in the routing // table is indexed by a destination, and contains the // destination's cost and a set of paths to use in forwarding // packets to the destination. A path is described by its type and // next hop. For more information, see Section 11. RoutingTable *RoutingTable // contains filtered or unexported fields }
func NewInstance ¶
func NewInstance(ctx context.Context, c *InstanceConfig) *Instance
type InstanceConfig ¶
type Interface ¶
type Interface struct { // The OSPF interface type is either point-to-point, broadcast, // NBMA, Point-to-MultiPoint or virtual link. // Not actually used yet. Type InterfaceType MTU uint16 // The functional level of an interface. State determines whether // or not full adjacencies are allowed to form over the interface. // State is also reflected in the router's LSAs. State InterfaceState // The IP address associated with the interface. This appears as // the IP source address in all routing protocol packets originated // over this interface. Interfaces to unnumbered point-to-point // networks do not have an associated IP address. // Also referred to as the subnet mask, this indicates the portion // of the IP interface address that identifies the attached // network. Masking the IP interface address with the IP interface // mask yields the IP network number of the attached network. On // point-to-point networks and virtual links, the IP interface mask // is not defined. On these networks, the link itself is not // assigned an IP network number, and so the addresses of each side // of the link are assigned independently, if they are assigned at // all. Address *net.IPNet // The Area ID of the area to which the attached network belongs. // All routing protocol packets originating from the interface are // labelled with this Area ID. Area *Area // An 8-bit unsigned integer. When two routers attached to a // network both attempt to become Designated Router, the one with // the highest Router Priority takes precedence. A router whose // Router Priority is set to 0 is ineligible to become Designated // Router on the attached network. Advertised in Hello packets // sent out this interface. RouterPriority uint8 // The length of time, in seconds, between the Hello packets that // the router sends on the interface. Advertised in Hello packets // sent out this interface. HelloInterval uint16 // An interval timer that causes the interface to send a Hello // packet. This timer fires every HelloInterval seconds. Note // that on non-broadcast networks a separate Hello packet is sent // to each qualified neighbor. HelloTicker *TickerFunc // The number of seconds before the router's neighbors will declare // it down, when they stop hearing the router's Hello Packets. // Advertised in Hello packets sent out this interface. RouterDeadInterval uint32 // A single shot timer that causes the interface to exit the // Waiting state, and as a consequence select a Designated Router // on the network. The length of the timer is RouterDeadInterval // seconds. WaitTimer *time.Timer // The Designated Router selected for the attached network. The // Designated Router is selected on all broadcast and NBMA networks // by the Hello Protocol. Two pieces of identification are kept // for the Designated Router: its Router ID and its IP interface // address on the network. The Designated Router advertises link // state for the network; this network-LSA is labelled with the // Designated Router's IP address. The Designated Router is // initialized to 0.0.0.0, which indicates the lack of a Designated // Router. DR atomic.Uint32 // The Backup Designated Router is also selected on all broadcast // and NBMA networks by the Hello Protocol. All routers on the // attached network become adjacent to both the Designated Router // and the Backup Designated Router. The Backup Designated Router // becomes Designated Router when the current Designated Router // fails. The Backup Designated Router is initialized to 0.0.0.0, // indicating the lack of a Backup Designated Router. BDR atomic.Uint32 // The other routers attached to this network. This list is formed // by the Hello Protocol. Adjacencies will be formed to some of // these neighbors. The set of adjacent neighbors can be // determined by an examination of all of the neighbors' states. Neighbors map[uint32]*Neighbor // The cost of sending a packet on the interface, expressed in // the link state metric. This is advertised as the link cost // for this interface in the router's router-LSA. The interface // output cost must always be greater than 0. OutputCost int // The number of seconds between LSA retransmissions, for // adjacencies belonging to this interface. Also used when // retransmitting Database Description and Link State Request // Packets. This should be well over the expected round-trip // delay between any two routers on the attached network. The // setting of this value should be conservative or needless // retransmissions will result. Sample value for a local area // network: 5 seconds. RxmtInterval int // The estimated number of seconds it takes to transmit a Link // State Update Packet over this interface. LSAs contained in // the update packet must have their age incremented by this // amount before transmission. This value should take into // account the transmission and propagation delays of the // interface. It must be greater than 0. Sample value for a // local area network: 1 second. InfTransDelay uint16 // TODO AuType string // TODO Authentication string // contains filtered or unexported fields }
func NewInterface ¶
func NewInterface(ctx context.Context, c *InterfaceConfig) *Interface
type InterfaceConfig ¶
type InterfaceState ¶
type InterfaceState uint8
const ( // InterfaceDown This is the initial interface state. In this state, the // lower-level protocols have indicated that the interface is // unusable. No protocol traffic at all will be sent or // received on such a interface. In this state, interface // parameters should be set to their initial values. All // interface timers should be disabled, and there should be no // adjacencies associated with the interface. InterfaceDown InterfaceState = iota // InterfaceLoopBack In this state, the router's interface to the network is // looped back. The interface may be looped back in hardware // or software. The interface will be unavailable for regular // data traffic. However, it may still be desirable to gain // information on the quality of this interface, either through // sending ICMP pings to the interface or through something // like a bit error test. For this reason, IP packets may // still be addressed to an interface in Loopback state. To // facilitate this, such interfaces are advertised in router- // LSAs as single host routes, whose destination is the IP // interface address.[4] InterfaceLoopBack // InterfaceWaiting In this state, the router is trying to determine the // identity of the (Backup) Designated Router for the network. // To do this, the router monitors the Hello Packets it // receives. The router is not allowed to elect a Backup // Designated Router nor a Designated Router until it // transitions out of Waiting state. This prevents unnecessary // changes of (Backup) Designated Router. InterfaceWaiting // InterfacePointToPoint In this state, the interface is operational, and connects // either to a physical point-to-point network or to a virtual // link. Upon entering this state, the router attempts to form // an adjacency with the neighboring router. Hello Packets are // sent to the neighbor every HelloInterval seconds. InterfacePointToPoint // InterfaceDROther The interface is to a broadcast or NBMA network on which // another router has been selected to be the Designated // Router. In this state, the router itself has not been // selected Backup Designated Router either. The router forms // adjacencies to both the Designated Router and the Backup // Designated Router (if they exist). InterfaceDROther // InterfaceBackup In this state, the router itself is the Backup Designated // Router on the attached network. It will be promoted to // Designated Router when the present Designated Router fails. // The router establishes adjacencies to all other routers // attached to the network. The Backup Designated Router // performs slightly different functions during the Flooding // Procedure, as compared to the Designated Router (see Section // 13.3). See Section 7.4 for more details on the functions // performed by the Backup Designated Router. InterfaceBackup // InterfaceDR In this state, this router itself is the Designated Router // on the attached network. Adjacencies are established to all // other routers attached to the network. The router must also // originate a network-LSA for the network node. The network- // LSA will contain links to all routers (including the // Designated Router itself) attached to the network. See // Section 7.3 for more details on the functions performed by // the Designated Router. InterfaceDR )
type InterfaceStateChangingEvent ¶
type InterfaceStateChangingEvent int
const ( // IfEvInterfaceUp Lower-level protocols have indicated that the network // interface is operational. This enables the interface to // transition out of Down state. On virtual links, the // interface operational indication is actually a result of the // shortest path calculation (see Section 16.7). IfEvInterfaceUp InterfaceStateChangingEvent // IfEvWaitTimer The Wait Timer has fired, indicating the end of the waiting // period that is required before electing a (Backup) // Designated Router. IfEvWaitTimer // IfEvBackupSeen The router has detected the existence or non-existence of a // Backup Designated Router for the network. This is done in // one of two ways. First, an Hello Packet may be received // from a neighbor claiming to be itself the Backup Designated // Router. Alternatively, an Hello Packet may be received from // a neighbor claiming to be itself the Designated Router, and // indicating that there is no Backup Designated Router. In // either case there must be bidirectional communication with // the neighbor, i.e., the router must also appear in the // neighbor's Hello Packet. This event signals an end to the // Waiting state. IfEvBackupSeen // IfEvNeighborChange There has been a change in the set of bidirectional // neighbors associated with the interface. The (Backup) // Designated Router needs to be recalculated. The following // neighbor changes lead to the NeighborChange event. For an // explanation of neighbor states, see Section 10.1. // // o Bidirectional communication has been established to a // neighbor. In other words, the state of the neighbor has // transitioned to 2-Way or higher. // // o There is no longer bidirectional communication with a // neighbor. In other words, the state of the neighbor has // transitioned to Init or lower. // // o One of the bidirectional neighbors is newly declaring // itself as either Designated Router or Backup Designated // Router. This is detected through examination of that // neighbor's Hello Packets. // // o One of the bidirectional neighbors is no longer // declaring itself as Designated Router, or is no longer // declaring itself as Backup Designated Router. This is // again detected through examination of that neighbor's // Hello Packets. // // o The advertised Router Priority for a bidirectional // neighbor has changed. This is again detected through // examination of that neighbor's Hello Packets. IfEvNeighborChange // IfEvLoopInd An indication has been received that the interface is now // looped back to itself. This indication can be received // either from network management or from the lower level // protocols. IfEvLoopInd // IfEvUnLoopInd An indication has been received that the interface is no // longer looped back. As with the LoopInd event, this // indication can be received either from network management or // from the lower level protocols. IfEvUnLoopInd // IfEvInterfaceDown Lower-level protocols indicate that this interface is no // longer functional. No matter what the current interface // state is, the new interface state will be Down. IfEvInterfaceDown )
type InterfaceType ¶
type InterfaceType uint8
const ( IfTypePointToPoint InterfaceType IfTypeBroadcast IfTypeNBMA IfTypePointToMultiPoint IfTypeVirtualLink )
type LSDBASExternalItem ¶
type LSDBASExternalItem struct {
// contains filtered or unexported fields
}
type LSDBNetworkItem ¶
type LSDBNetworkItem struct {
// contains filtered or unexported fields
}
type LSDBRouterItem ¶
type LSDBRouterItem struct {
// contains filtered or unexported fields
}
type LSDBSummaryItem ¶
type LSDBSummaryItem struct {
// contains filtered or unexported fields
}
type Neighbor ¶
type Neighbor struct { // The functional level of the neighbor conversation. This is // described in more detail in Section 10.1. State NeighborState // A single shot timer whose firing indicates that no Hello Packet // has been seen from this neighbor recently. The length of the // timer is RouterDeadInterval seconds. InactivityTimer *time.Timer // When the two neighbors are exchanging databases, they form a // master/slave relationship. The master sends the first Database // Description Packet, and is the only part that is allowed to // retransmit. The slave can only respond to the master's Database // Description Packets. The master/slave relationship is // negotiated in state ExStart. IsMaster bool // The DD Sequence number of the Database Description packet that // is currently being sent to the neighbor. DDSeqNumber atomic.Uint32 // The initialize(I), more (M) and master(MS) bits, Options field, // and DD sequence number contained in the last Database // Description packet received from the neighbor. Used to determine // whether the next Database Description packet received from the // neighbor is a duplicate. LastReceivedDDPacket TSS[*packet.OSPFv2Packet[packet.DbDescPayload]] NeighborId uint32 // The Router Priority of the neighboring router. Contained in the // neighbor's Hello packets, this item is used when selecting the // Designated Router for the attached network. NeighborPriority uint8 // The IP address of the neighboring router's interface to the // attached network. Used as the Destination IP address when // protocol packets are sent as unicasts along this adjacency. // Also used in router-LSAs as the Link ID for the attached network // if the neighboring router is selected to be Designated Router // (see Section 12.4.1). The Neighbor IP address is learned when // Hello packets are received from the neighbor. For virtual // links, the Neighbor IP address is learned during the routing // table build process (see Section 15). NeighborAddress net.IP // The optional OSPF capabilities supported by the neighbor. // Learned during the Database Exchange process (see Section 10.6). // The neighbor's optional OSPF capabilities are also listed in its // Hello packets. This enables received Hello Packets to be // rejected (i.e., neighbor relationships will not even start to // form) if there is a mismatch in certain crucial OSPF // capabilities (see Section 10.5). The optional OSPF capabilities // are documented in Section 4.5. NeighborOptions packet.BitOption // The neighbor's idea of the Designated Router address. If this is the // neighbor itself, this is important in the local calculation of // the Designated Router. Defined only on broadcast and NBMA // networks. NeighborsDR uint32 // The neighbor's idea of the Backup Designated Router address. If this is // the neighbor itself, this is important in the local calculation // of the Backup Designated Router. Defined only on broadcast and // NBMA networks. NeighborsBDR uint32 // The list of LSAs that have been flooded but not acknowledged on // this adjacency. These will be retransmitted at intervals until // they are acknowledged, or until the adjacency is destroyed. LSRetransmission map[packet.LSAIdentity]struct{} // The complete list of LSAs that make up the area link-state // database, at the moment the neighbor goes into Database Exchange // state. This list is sent to the neighbor in Database // Description packets. DatabaseSummary []packet.LSAIdentity // The list of LSAs that need to be received from this neighbor in // order to synchronize the two neighbors' link-state databases. // This list is created as Database Description packets are // received, and is then sent to the neighbor in Link State Request // packets. The list is depleted as appropriate Link State Update // packets are received. LSRequest []packet.LSAheader // contains filtered or unexported fields }
type NeighborState ¶
type NeighborState int
const ( // NeighborDown This is the initial state of a neighbor conversation. It // indicates that there has been no recent information received // from the neighbor. On NBMA networks, Hello packets may // still be sent to "Down" neighbors, although at a reduced // frequency (see Section 9.5.1). NeighborDown NeighborState = iota // NeighborAttempt This state is only valid for neighbors attached to NBMA // networks. It indicates that no recent information has been // received from the neighbor, but that a more concerted effort // should be made to contact the neighbor. This is done by // sending the neighbor Hello packets at intervals of // HelloInterval (see Section 9.5.1). NeighborAttempt // NeighborInit In this state, an Hello packet has recently been seen from // the neighbor. However, bidirectional communication has not // yet been established with the neighbor (i.e., the router // itself did not appear in the neighbor's Hello packet). All // neighbors in this state (or higher) are listed in the Hello // packets sent from the associated interface. NeighborInit // Neighbor2Way In this state, communication between the two routers is // bidirectional. This has been assured by the operation of // the Hello Protocol. This is the most advanced state short // of beginning adjacency establishment. The (Backup) // Designated Router is selected from the set of neighbors in // state 2-Way or greater. Neighbor2Way // NeighborExStart This is the first step in creating an adjacency between the // two neighboring routers. The goal of this step is to decide // which router is the master, and to decide upon the initial // DD sequence number. Neighbor conversations in this state or // greater are called adjacencies. NeighborExStart // NeighborExchange In this state the router is describing its entire link state // database by sending Database Description packets to the // neighbor. Each Database Description Packet has a DD // sequence number, and is explicitly acknowledged. Only one // Database Description Packet is allowed outstanding at any // one time. In this state, Link State Request Packets may // also be sent asking for the neighbor's more recent LSAs. // All adjacencies in Exchange state or greater are used by the // flooding procedure. In fact, these adjacencies are fully // capable of transmitting and receiving all types of OSPF // routing protocol packets. NeighborExchange // NeighborLoading In this state, Link State Request packets are sent to the // neighbor asking for the more recent LSAs that have been // discovered (but not yet received) in the Exchange state. NeighborLoading // NeighborFull In this state, the neighboring routers are fully adjacent. // These adjacencies will now appear in router-LSAs and // network-LSAs. NeighborFull )
func (NeighborState) String ¶
func (ns NeighborState) String() string
type NeighborStateChangingEvent ¶
type NeighborStateChangingEvent int
const ( // NbEvHelloReceived An Hello packet has been received from the neighbor. NbEvHelloReceived NeighborStateChangingEvent // NbEvStart this is an indication that Hello Packets should now be sent // to the neighbor at intervals of HelloInterval seconds. This // event is generated only for neighbors associated with NBMA // networks. NbEvStart // NbEv2WayReceived Bidirectional communication has been realized between the // two neighboring routers. This is indicated by the router // seeing itself in the neighbor's Hello packet. NbEv2WayReceived // NbEvNegotiationDone The Master/Slave relationship has been negotiated, and DD // sequence numbers have been exchanged. This signals the // start of the sending/receiving of Database Description // packets. For more information on the generation of this // event, consult Section 10.8. NbEvNegotiationDone // NbEvExchangeDone Both routers have successfully transmitted a full sequence // of Database Description packets. Each router now knows what // parts of its link state database are out of date. For more // information on the generation of this event, consult Section // 10.8. NbEvExchangeDone // NbEvBadLSReq A Link State Request has been received for an LSA not // contained in the database. This indicates an error in the // Database Exchange process. NbEvBadLSReq // NbEvLoadingDone Link State Updates have been received for all out-of-date // portions of the database. This is indicated by the Link // state request list becoming empty after the Database // Exchange process has completed. NbEvLoadingDone // NbEvIsAdjOK A decision must be made as to whether an adjacency should be // established/maintained with the neighbor. This event will // start some adjacencies forming, and destroy others. NbEvIsAdjOK // NbEvSeqNumberMismatch A Database Description packet has been received that either // a) has an unexpected DD sequence number, b) unexpectedly has // the Init bit set or c) has an Options field differing from // the last Options field received in a Database Description // packet. Any of these conditions indicate that some error // has occurred during adjacency establishment. NbEvSeqNumberMismatch // NbEv1Way An Hello packet has been received from the neighbor, in // which the router is not mentioned. This indicates that // communication with the neighbor is not bidirectional. NbEv1Way // NbEvKillNbr This is an indication that all communication with the // neighbor is now impossible, forcing the neighbor to // revert to Down state. NbEvKillNbr // NbEvInactivityTimer The inactivity Timer has fired. This means that no Hello // packets have been seen recently from the neighbor. The // neighbor reverts to Down state. NbEvInactivityTimer // NbEvLLDown This is an indication from the lower level protocols that // the neighbor is now unreachable. For example, on an X.25 // network this could be indicated by an X.25 clear indication // with appropriate cause and diagnostic fields. This event // forces the neighbor into Down state. NbEvLLDown )
type RoutingDestinationType ¶
type RoutingDestinationType uint8
const ( RoutingDestTypeNetwork RoutingDestinationType RoutingDestTypeRouter )
type RoutingPathType ¶
type RoutingPathType uint8
const ( RoutingPathIntraArea RoutingPathType RoutingPathInterArea RoutingPathExternalType1 RoutingPathExternalType2 )
type RoutingTable ¶
type RoutingTable struct {
List []*RoutingTableEntry
}
type RoutingTableEntry ¶
type RoutingTableEntry struct { // Destination type is either "network" or "router". Only network // entries are actually used when forwarding IP data traffic. // Router routing table entries are used solely as intermediate // steps in the routing table build process. // // A network is a range of IP addresses, to which IP data traffic // may be forwarded. This includes IP networks (class A, B, or C), // IP subnets, IP supernets and single IP hosts. The default route // also falls into this category. // // Router entries are kept for area border routers and AS boundary // routers. Routing table entries for area border routers are used // when calculating the inter-area routes (see Section 16.2), and // when maintaining configured virtual links (see Section 15). // Routing table entries for AS boundary routers are used when // calculating the AS external routes (see Section 16.4). DestinationType RoutingDestinationType // The destination's identifier or name. This depends on the // Destination Type. For networks, the identifier is their // associated IP address. For routers, the identifier is the OSPF // Router ID.[9] DestinationId uint32 // Only defined for networks. The network's IP address together // with its address mask defines a range of IP addresses. For IP // subnets, the address mask is referred to as the subnet mask. // For host routes, the mask is "all ones" (0xffffffff). AddressMask net.IPMask // When the destination is a router this field indicates the // optional OSPF capabilities supported by the destination router. // The only optional capability defined by this specification is // the ability to process AS-external-LSAs. For a further // discussion of OSPF's optional capabilities, see Section 4.5. Options packet.BitOption // This field indicates the area whose link state information has // led to the routing table entry's collection of paths. This is // called the entry's associated area. For sets of AS external // paths, this field is not defined. For destinations of type // "router", there may be separate sets of paths (and therefore // separate routing table entries) associated with each of several // areas. For example, this will happen when two area border // routers share multiple areas in common. For destinations of // type "network", only the set of paths associated with the best // area (the one providing the preferred route) is kept. Area uint32 // There are four possible types of paths used to route traffic to // the destination, listed here in decreasing order of preference: // intra-area, inter-area, type 1 external or type 2 external. // Intra-area paths indicate destinations belonging to one of the // router's attached areas. Inter-area paths are paths to // destinations in other OSPF areas. These are discovered through // the examination of received summary-LSAs. AS external paths are // paths to destinations external to the AS. These are detected // through the examination of received AS-external-LSAs. PathType RoutingPathType // The link state cost of the path to the destination. For all // paths except type 2 external paths this describes the entire // path's cost. For Type 2 external paths, this field describes // the cost of the portion of the path internal to the AS. This // cost is calculated as the sum of the costs of the path's // constituent links. Cost int // Only valid for type 2 external paths. For these paths, this // field indicates the cost of the path's external portion. This // cost has been advertised by an AS boundary router, and is the // most significant part of the total path cost. For example, a // type 2 external path with type 2 cost of 5 is always preferred // over a path with type 2 cost of 10, regardless of the cost of // the two paths' internal components. CostType2 int // Valid only for intra-area paths, this field indicates the LSA // (router-LSA or network-LSA) that directly references the // destination. For example, if the destination is a transit // network, this is the transit network's network-LSA. If the // destination is a stub network, this is the router-LSA for the // attached router. The LSA is discovered during the shortest-path // tree calculation (see Section 16.1). Multiple LSAs may // reference the destination, however a tie-breaking scheme always // reduces the choice to a single LSA. The Link State Origin field // is not used by the OSPF protocol, but it is used by the routing // table calculation in OSPF's Multicast routing extensions // (MOSPF). LinkStateOrigin []byte // The outgoing router interface to use when forwarding traffic to // the destination. On broadcast, Point-to-MultiPoint and NBMA // networks, the next hop also includes the IP address of the next // router (if any) in the path towards the destination. NextHop *Interface // Valid only for inter-area and AS external paths. This field // indicates the Router ID of the router advertising the summary- // LSA or AS-external-LSA that led to this path. AdvertisingRouter uint32 }
type TSS ¶
type TSS[T any] struct { // contains filtered or unexported fields }
TSS for thread-safe struct
type TickerFunc ¶
type TickerFunc struct {
// contains filtered or unexported fields
}
func TimeTickerFunc ¶
func (*TickerFunc) Reset ¶
func (t *TickerFunc) Reset()
func (*TickerFunc) Suspend ¶
func (t *TickerFunc) Suspend()
func (*TickerFunc) Terminate ¶
func (t *TickerFunc) Terminate()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.