Skip to content

Commit

Permalink
Merge neighbors package up to the main presence package
Browse files Browse the repository at this point in the history
  • Loading branch information
douglaswth committed Jun 26, 2022
1 parent fb543af commit 070172f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions neighbors/arp.go → arp.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package neighbors
package presence

import (
"context"

"douglasthrift.net/presence"
)

type (
Interfaces map[string]bool
HardwareAddrStates map[string]presence.State
HardwareAddrStates map[string]State

ARP interface {
Present(ctx context.Context, ifs Interfaces, addrs HardwareAddrStates) (bool, error)
Expand Down
2 changes: 1 addition & 1 deletion neighbors/arp_freebsd.go → arp_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neighbors
package presence

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion neighbors/arp_linux.go → arp_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neighbors
package presence

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion neighbors/arping.go → arping.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neighbors
package presence

import (
"bufio"
Expand Down
7 changes: 3 additions & 4 deletions cmd/presence/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import (
"os"

"douglasthrift.net/presence"
"douglasthrift.net/presence/neighbors"
)

func main() {
ifs := neighbors.Interfaces{os.Args[1]: true}
hws := make(neighbors.HardwareAddrStates, len(os.Args[2:]))
ifs := presence.Interfaces{os.Args[1]: true}
hws := make(presence.HardwareAddrStates, len(os.Args[2:]))
for _, hw := range os.Args[2:] {
hws[hw] = presence.NewState()
}

ctx := context.Background()
a, err := neighbors.NewARP(1)
a, err := presence.NewARP(1)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 070172f

Please sign in to comment.