diff --git a/Dockerfile b/Dockerfile
index ccc9093..d8e3441 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -12,7 +12,8 @@ RUN apk update && apk upgrade && \
apk add --no-cache git && \
go get -d github.com/gorilla/handlers && \
go get -d github.com/gorilla/mux && \
- go get -d github.com/gocarina/gocsv
+ go get -d github.com/gocarina/gocsv && \
+ go get -d github.com/tatsushid/go-fastping
# Build Source Files
RUN go build -o main .
diff --git a/computer.csv b/computer.csv
index 8b6f8b0..c023226 100644
--- a/computer.csv
+++ b/computer.csv
@@ -1,4 +1,4 @@
-name,mac,ip
-Computer1,64-07-2D-BB-BB-BF,192.168.10.254:9
-Computer2,2D-F2-3D-06-17-00,192.168.10.254:9
-Computer3,FF-B3-95-62-1C-DD,192.168.10.254:9
\ No newline at end of file
+name,mac,ip,broadcast
+Computer1,64-07-2D-BB-BB-BF,192.168.10.4,192.168.10.254:9
+Computer2,2D-F2-3D-06-17-00,192.168.10.5,192.168.10.254:9
+Computer3,FF-B3-95-62-1C-DD,192.168.10.6,192.168.10.254:9
diff --git a/go-rest-wol b/go-rest-wol
new file mode 100755
index 0000000..9054f11
Binary files /dev/null and b/go-rest-wol differ
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..1bf4872
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,11 @@
+module github.com/alfonsocatanzaro/go-rest-wol
+
+go 1.14
+
+require (
+ github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3
+ github.com/gorilla/handlers v1.4.2
+ github.com/gorilla/mux v1.7.4
+ github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e
+ golang.org/x/net v0.0.0-20200513185701-a91f0712d120 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..d57d9df
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,15 @@
+github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3 h1:B7k6N+JlLM/u1xrIkpifUfE7GRJsZIYHoHbiAa5cSP4=
+github.com/gocarina/gocsv v0.0.0-20200330101823-46266ca37bd3/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI=
+github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
+github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
+github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
+github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
+github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e h1:nt2877sKfojlHCTOBXbpWjBkuWKritFaGIfgQwbQUls=
+github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e/go.mod h1:B4+Kq1u5FlULTjFSM707Q6e/cOHFv0z/6QRoxubDIQ8=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY=
+golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/main.go b/main.go
index 0b2f56c..6d784be 100644
--- a/main.go
+++ b/main.go
@@ -14,6 +14,8 @@ var ComputerList []Computer
func main() {
+
+
httpPort := DefaultHTTPPort
computerFilePath := DefaultComputerFilePath
@@ -39,6 +41,10 @@ func main() {
router.HandleFunc("/api/wakeup/computer/{computerName}", restWakeUpWithComputerName).Methods("GET")
router.HandleFunc("/api/wakeup/computer/{computerName}/", restWakeUpWithComputerName).Methods("GET")
+ // Define Wakeup Api functions with a Computer Name
+ router.HandleFunc("/api/ping/computer/{computerName}", pingWithComputerName).Methods("GET")
+ router.HandleFunc("/api/ping/computer/{computerName}/", pingWithComputerName).Methods("GET")
+
// Setup Webserver
httpListen := fmt.Sprint(":", httpPort)
log.Printf("Startup Webserver on \"%s\"", httpListen)
diff --git a/pages/index.html b/pages/index.html
index 7dec997..c6191f5 100644
--- a/pages/index.html
+++ b/pages/index.html
@@ -4,7 +4,7 @@
-
+