service ping
This commit is contained in:
parent
5bad6c2991
commit
ba2d1c099e
28
Gopkg.toml
28
Gopkg.toml
|
@ -1,6 +1,6 @@
|
||||||
# Gopkg.toml example
|
# Gopkg.toml example
|
||||||
#
|
#
|
||||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||||
# for detailed Gopkg.toml documentation.
|
# for detailed Gopkg.toml documentation.
|
||||||
#
|
#
|
||||||
# required = ["github.com/user/thing/cmd/thing"]
|
# required = ["github.com/user/thing/cmd/thing"]
|
||||||
|
@ -59,12 +59,24 @@
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/google/gopacket"
|
name = "github.com/google/gopacket"
|
||||||
version = "1.1.14"
|
version = "1.1.15"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/grandcat/zeroconf"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/huin/goupnp"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/k-sone/snmpgo"
|
name = "github.com/k-sone/snmpgo"
|
||||||
version = "3.2.0"
|
version = "3.2.0"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "github.com/satori/go.uuid"
|
||||||
|
version = "1.2.0"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/valyala/fasthttp"
|
name = "github.com/valyala/fasthttp"
|
||||||
version = "20180529.0.0"
|
version = "20180529.0.0"
|
||||||
|
@ -73,14 +85,10 @@
|
||||||
name = "go.uber.org/zap"
|
name = "go.uber.org/zap"
|
||||||
version = "1.9.1"
|
version = "1.9.1"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/sync"
|
||||||
|
|
||||||
[prune]
|
[prune]
|
||||||
go-tests = true
|
go-tests = true
|
||||||
unused-packages = true
|
unused-packages = true
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/grandcat/zeroconf"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/huin/goupnp"
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package __test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
omd "git.loafle.net/overflow/model/discovery"
|
omd "git.loafle.net/overflow/model/discovery"
|
||||||
omm "git.loafle.net/overflow/model/meta"
|
omm "git.loafle.net/overflow/model/meta"
|
||||||
|
@ -43,6 +44,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Zone() *omd.Zone {
|
func Zone() *omd.Zone {
|
||||||
|
strings.Builder
|
||||||
return omd.NewZone(
|
return omd.NewZone(
|
||||||
ZONE_IFACE,
|
ZONE_IFACE,
|
||||||
ZONE_MAC,
|
ZONE_MAC,
|
||||||
|
|
|
@ -46,14 +46,16 @@ func processPing(service *omd.Service, pingOption ounp.Option, _pingFunc pingFun
|
||||||
|
|
||||||
for indexR := 0; indexR < pingOption.GetCount(); indexR++ {
|
for indexR := 0; indexR < pingOption.GetCount(); indexR++ {
|
||||||
summary.SendCount = summary.SendCount + 1
|
summary.SendCount = summary.SendCount + 1
|
||||||
|
if 0 < indexR {
|
||||||
|
// select {
|
||||||
|
// case <-time.After(time.Duration(pingOption.GetInterval()) * time.Second):
|
||||||
|
// }
|
||||||
|
time.Sleep(time.Duration(pingOption.GetInterval()) * time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
|
|
||||||
_res = &ounp.PingResponse{}
|
_res = &ounp.PingResponse{}
|
||||||
if 0 < indexR {
|
|
||||||
select {
|
|
||||||
case <-time.After(time.Duration(pingOption.GetDeadline()) * time.Second):
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ttl, err := _pingFunc(service, pingOption)
|
ttl, err := _pingFunc(service, pingOption)
|
||||||
elapsedTime := float64(time.Since(startTime).Nanoseconds()) / float64(1E6)
|
elapsedTime := float64(time.Since(startTime).Nanoseconds()) / float64(1E6)
|
||||||
|
|
|
@ -39,6 +39,8 @@ func New() *ossw.Server {
|
||||||
sh.Name = "Probe"
|
sh.Name = "Probe"
|
||||||
sh.Services = services
|
sh.Services = services
|
||||||
sh.PubSub = _pubsub
|
sh.PubSub = _pubsub
|
||||||
|
sh.ReadBufferSize = 8192
|
||||||
|
sh.WriteBufferSize = 8192
|
||||||
|
|
||||||
sh.RegisterServlet("/scanner", ss)
|
sh.RegisterServlet("/scanner", ss)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user