diff options
author | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-11-02 18:57:56 -0400 |
---|---|---|
committer | David Doan <daviddoan@Davids-MacBook-Pro-70.local> | 2023-11-02 18:57:56 -0400 |
commit | 5d7ffd42b638f33d32c01c46f853e26a5028b552 (patch) | |
tree | ed7220178ce76a213341f14fb27c6af63e95209a /cmd/vrouter/main.go | |
parent | a8c9b48821c85e072ca9054621928e415540b12c (diff) |
milestone 1
Diffstat (limited to 'cmd/vrouter/main.go')
-rw-r--r-- | cmd/vrouter/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
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") |