aboutsummaryrefslogtreecommitdiff
path: root/cmd/vrouter/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/vrouter/main.go')
-rw-r--r--cmd/vrouter/main.go8
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")