diff options
author | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-10-23 18:00:09 -0400 |
---|---|---|
committer | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-10-23 18:00:09 -0400 |
commit | 8410dde94f746c254d62461947abbe68d25009b2 (patch) | |
tree | 27f4f3fef199d67c8b86ed82a0b3c24fd8db76a2 /cmd/vrouter | |
parent | aaa3e0e5279c534bb07856bbce867e4cde2ed255 (diff) |
comments and refactoring
Diffstat (limited to 'cmd/vrouter')
-rw-r--r-- | cmd/vrouter/main.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/vrouter/main.go b/cmd/vrouter/main.go index 02104c5..0bc4d98 100644 --- a/cmd/vrouter/main.go +++ b/cmd/vrouter/main.go @@ -76,7 +76,8 @@ func main() { messageToSendBytes := []byte(messageToSend) // get the longest prefix match for the destination - hop, err := ipstack.LongestPrefix(netip.MustParseAddr(ipAddr)) + address, _ := netip.ParseAddr(ipAddr) + hop, err := ipstack.LongestPrefix(address) if err != nil { fmt.Println(err) continue @@ -85,7 +86,7 @@ func main() { myAddr := hop.Interface.IpPrefix.Addr() // attempt to send the message to the destination for _, neighbor := range ipstack.GetNeighbors()[hop.Interface.Name] { - if neighbor.VipAddr == netip.MustParseAddr(ipAddr) || + if neighbor.VipAddr == address || neighbor.VipAddr == hop.VIP { // send the message to the neighbor bytesWritten, err := ipstack.SendIP(&myAddr, neighbor, ipstack.TEST_PROTOCOL, messageToSendBytes, ipAddr, nil) |