Skip to content

Commit ffab59b

Browse files
committed
fixed compile errors from last commit
1 parent 6e74e62 commit ffab59b

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

netcat/main.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func printUsage() {
1919
fmt.Println("Example SCION address: 17-ffaa:1:bfd,[127.0.0.1]:42002")
2020
fmt.Println("Available flags:")
2121
fmt.Println(" -h: Show help")
22-
fmt.Println(" -P: Use IA when resolving SCIOND socket path")
22+
fmt.Println(" -local: Use IA when resolving SCIOND socket path")
2323
fmt.Println(" -b: Send an extra byte before sending the actual data")
2424
}
2525

@@ -32,42 +32,40 @@ func main() {
3232
port uint16
3333
useIASCIONDPath bool
3434
extraByte bool
35-
)
36-
flag.BoolVar(&showHelp, "h", false, "Show help")
37-
flag.BoolVar(&USE_IA_SCIOND_PATH, "P", false, "Use IA SCIOND Path")
38-
flag.BoolVar(&SEND_PIPER_BYTE, "b", false, "Send extra byte")
35+
)
36+
flag.Usage = printUsage
37+
flag.BoolVar(&useIASCIONDPath, "local", false, "Use IA SCIOND Path")
38+
flag.BoolVar(&useIASCIONDPath, "b", false, "Send extra byte")
3939
flag.Parse()
40-
if showHelp {
41-
printUsage()
42-
return
43-
}
4440

4541
tail := flag.Args()
4642
if len(tail) != 2 {
43+
printUsage()
4744
golog.Panicf("Number of arguments is not two! Arguments: %v", tail)
4845
}
4946

50-
SERVER_ADDRESS = tail[0]
47+
serverAddress = tail[0]
5148
port64, err := strconv.ParseUint(tail[1], 10, 16)
5249
if err != nil {
50+
printUsage()
5351
golog.Panicf("Can't parse port string %v: %v", port64, err)
5452
}
55-
PORT = uint16(port64)
53+
port = uint16(port64)
5654

5755
// Initialize SCION library
58-
err = utils.InitSCION("", "", USE_IA_SCIOND_PATH)
56+
err = utils.InitSCION("", "", useIASCIONDPath)
5957
if err != nil {
6058
golog.Panicf("Error initializing SCION connection: %v", err)
6159
}
6260

63-
conn, err := utils.DialSCION(fmt.Sprintf("%s:%v", SERVER_ADDRESS, PORT))
61+
conn, err := utils.DialSCION(fmt.Sprintf("%s:%v", serverAddress, port))
6462
if err != nil {
6563
golog.Panicf("Error dialing remote: %v", err)
6664
}
6765

6866
log.Debug("Connected!")
6967

70-
if SEND_PIPER_BYTE {
68+
if extraByte {
7169
_, err := conn.Write([]byte{71})
7270
if err != nil {
7371
golog.Panicf("Error writing extra byte: %v", err)

0 commit comments

Comments
 (0)