Browse Source

Merge neighbors package up to the main presence package

Douglas Thrift 1 year ago
parent
commit
070172f407
5 changed files with 8 additions and 11 deletions
  1. 2 4
      arp.go
  2. 1 1
      arp_freebsd.go
  3. 1 1
      arp_linux.go
  4. 1 1
      arping.go
  5. 3 4
      cmd/presence/main.go

+ 2 - 4
neighbors/arp.go → arp.go

@@ -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)

+ 1 - 1
neighbors/arp_freebsd.go → arp_freebsd.go

@@ -1,4 +1,4 @@
-package neighbors
+package presence
 
 import (
 	"context"

+ 1 - 1
neighbors/arp_linux.go → arp_linux.go

@@ -1,4 +1,4 @@
-package neighbors
+package presence
 
 import (
 	"context"

+ 1 - 1
neighbors/arping.go → arping.go

@@ -1,4 +1,4 @@
-package neighbors
+package presence
 
 import (
 	"bufio"

+ 3 - 4
cmd/presence/main.go

@@ -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)
 	}