add flags to client
This commit is contained in:
parent
7d1a358438
commit
6f91491127
@ -2,10 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
@ -63,8 +65,12 @@ func main() {
|
|||||||
output := make(chan string)
|
output := make(chan string)
|
||||||
|
|
||||||
signal.Notify(interrupt, os.Interrupt) // Notify the interrupt channel for SIGINT
|
signal.Notify(interrupt, os.Interrupt) // Notify the interrupt channel for SIGINT
|
||||||
|
hostname := flag.String("host", "localhost", "server hostname to connect to")
|
||||||
|
port := flag.Int("port", 7636, "port to connect to")
|
||||||
|
|
||||||
socketUrl := "ws://localhost:7636" + "/ws"
|
flag.Parse()
|
||||||
|
port_s := strconv.Itoa(*port)
|
||||||
|
socketUrl := "ws://" + *hostname + ":" + port_s + "/ws"
|
||||||
conn, _, err := websocket.DefaultDialer.Dial(socketUrl, nil)
|
conn, _, err := websocket.DefaultDialer.Dial(socketUrl, nil)
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user