From 5d7ffd42b638f33d32c01c46f853e26a5028b552 Mon Sep 17 00:00:00 2001 From: David Doan Date: Thu, 2 Nov 2023 18:57:56 -0400 Subject: milestone 1 --- cmd/vrouter/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmd/vrouter/main.go') diff --git a/cmd/vrouter/main.go b/cmd/vrouter/main.go index 2736525..f338b80 100644 --- a/cmd/vrouter/main.go +++ b/cmd/vrouter/main.go @@ -4,9 +4,11 @@ import ( "bufio" "fmt" "iptcp/pkg/ipstack" + // "iptcp/pkg/tcpstack" "net/netip" "os" "strings" + // "strconv" ) func main() { @@ -30,13 +32,17 @@ func main() { ipstack.RegisterProtocolHandler(ipstack.TEST_PROTOCOL) // register the rip protocol for the router ipstack.RegisterProtocolHandler(ipstack.RIP_PROTOCOL) + // register the TCP protocol for the handler + ipstack.RegisterProtocolHandler(ipstack.TCP_PROTOCOL) + // create a scanner to read from stdin for command-line inputs scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { line := scanner.Text() - switch line { + tokens := strings.Split(line, " ") + switch tokens[0] { // print the interfaces case "li": fmt.Println("Name\tAddr/Prefix\tState") -- cgit v1.2.3-70-g09d2