Skip to content

Commit

Permalink
fix some linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
xiam committed Feb 26, 2020
1 parent d7f744c commit 03657aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-today José Nieto, https://menteslibres.net/xiam
Copyright (c) 2016-today José Nieto, https://xiam.io

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
16 changes: 8 additions & 8 deletions arp/arp_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import (
"net"
"os/exec"
"regexp"
"strconv"
)

var lineMatch = regexp.MustCompile(`([0-9\.]+)\s+dev\s+([^\s]+)\s+lladdr\s+([0-9a-f:]+)`)

func hexToInt(h string) uint8 {
v, _ := strconv.ParseInt(h, 16, 16)
return uint8(v)
}

func doARPLookup(ip string) (*Address, error) {

ping := exec.Command("ping", "-c1", "-t1", ip)
ping.Run() // TODO: manually inject arp who has packet.
ping.Wait()
if err := ping.Run(); err != nil { // TODO: manually inject arp who has packet.
return nil, err
}

if err := ping.Wait(); err != nil {
return nil, err
}

cmd := exec.Command("ip", "n", "show", ip)
out, err := cmd.Output()
Expand Down
1 change: 0 additions & 1 deletion arp/arp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package arp

import (
"encoding/binary"
"fmt"
"net"
"testing"
)
Expand Down
12 changes: 4 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 José Nieto, https://menteslibres.net/malfunkt
// Copyright (c) 2016-present José Nieto, https://xiam.io
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -165,13 +165,9 @@ func main() {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt)
go func() {
for {
select {
case <-c:
log.Println("'stop' signal received; stopping...")
close(stop)
return
}
for range c {
log.Println("'stop' signal received; stopping...")
close(stop)
}
}()

Expand Down

0 comments on commit 03657aa

Please sign in to comment.