Skip to content
Snippets Groups Projects
Verified Commit 0cf415d9 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Get hostname and port from CLI

parent 9eaab22b
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import (
"bufio"
"crypto/tls"
"encoding/binary"
"flag"
"fmt"
"net"
)
......@@ -117,7 +118,11 @@ func parseProtocolInfo(data []byte) protocolInfo {
}
func main() {
conn := makeConnection("kuschku.de", 4242)
hostname := flag.String("hostname", "", "address of server to connect to")
port := flag.Int("port", 4242, "port of server to connect to")
flag.Parse()
conn := makeConnection(*hostname, *port)
conn.write(PROTOCOL_MAGIC | uint32(PROTOCOL_FEATURE_TLS))
supportedProtocols := []uint32{
PROTOCOL_DATASTREAM,
......@@ -128,7 +133,6 @@ func main() {
conn.write(1 << 31)
conn.flush()
protocolInfo := parseProtocolInfo(conn.read(4))
println("Read Protocol Info")
if protocolInfo.flagTLS {
conn.withTLS(false)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment