diff options
author | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-10-23 18:11:41 -0400 |
---|---|---|
committer | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-10-23 18:11:41 -0400 |
commit | 8b27a70aa14bc80ebabbb6e5cc14611b74cf6799 (patch) | |
tree | 4e224a866df3495f7d598217c3b9b0f276e12ca5 | |
parent | a749b7274e9976542914ded13bcd6a3df5962274 (diff) |
comments and refactoring
-rw-r--r-- | README.md | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -18,42 +18,50 @@ Because the vhost and vrouter are so similar, we maintain most of the logic with We build our abstractions for the IP layer and interfaces with the following structs: type Interface struct { + Name string IpPrefix netip.Prefix UdpAddr netip.AddrPort - RecvSocket net.UDPConn SocketChannel chan bool State bool + } type Neighbor struct { + Name string VipAddr netip.Addr UdpAddr netip.AddrPort + } type RIPHeader struct { + command uint16 numEntries uint16 + } type RIPEntry struct { + prefix netip.Prefix cost uint32 + } type Hop struct { + Cost uint32 Type string - Interface *Interface VIP netip.Addr + } With these structs, we are able to maintain the information necessary for the IPStack to function and for the vhost and vrouter to interact with its interfaces, neighbors, and routes when applicable. -# Initialization +# Initialization/Main Thread First we, parse the lnxfile and populate our the data structures such as myInterfaces, myNeighbors and routingTable based on the specification in the lnx files. For each not we create a UDP listener conn and utilize a go routines to listen on the UDP socket. |