Skip to content

Commit

Permalink
Respect also CheckConnectionUptime function
Browse files Browse the repository at this point in the history
  • Loading branch information
mcktr committed Sep 9, 2019
1 parent f548490 commit eda8b16
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmd/check_fritz/check_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ func CheckConnectionStatus(aI ArgumentInformation) {
GlobalReturnCode = exitUnknown
return
}

go fritz.DoSoapRequest(&soapReq, resps, errs)

res, err := fritz.ProcessSoapResponse(resps, errs, 1, *aI.Timeout)
Expand Down Expand Up @@ -71,7 +70,20 @@ func CheckConnectionUptime(aI ArgumentInformation) {
resps := make(chan []byte)
errs := make(chan error)

soapReq := fritz.CreateNewSoapData(*aI.Username, *aI.Password, *aI.Hostname, *aI.Port, "/upnp/control/wanpppconn1", "WANPPPConnection", "GetInfo")
modelgroup := strings.ToLower(*aI.Modelgroup)

var soapReq fritz.SoapData

switch modelgroup {
case "dsl":
soapReq = fritz.CreateNewSoapData(*aI.Username, *aI.Password, *aI.Hostname, *aI.Port, "/upnp/control/wanpppconn1", "WANPPPConnection", "GetInfo")
case "cable":
soapReq = fritz.CreateNewSoapData(*aI.Username, *aI.Password, *aI.Hostname, *aI.Port, "/upnp/control/wanipconnection1", "WanIPConnection", "GetInfo")
default:
fmt.Printf("UNKNOWN - Fritz!Box modelgroup '%s' is unknown. Supported modelgroups are: DSL, CABLE\n", modelgroup)
GlobalReturnCode = exitUnknown
return
}
go fritz.DoSoapRequest(&soapReq, resps, errs)

res, err := fritz.ProcessSoapResponse(resps, errs, 1, *aI.Timeout)
Expand Down

0 comments on commit eda8b16

Please sign in to comment.