Example #1
0
func Ping(pi pingInfo) pingResponse {
	pr := pingResponse{}
	pr.err = nil

	conn, err := icmp.ListenPacket("udp4", configuration.GetDeviceIP())

	if err != nil {
		msg := "Could not create a packet endpoint on ip: " + configuration.GetDeviceIP()
		fmt.Println(err)
		logger.WriteString(msg)
		pr.err = errors.New(msg)
		return pr
	}

	defer conn.Close()

	logger.WriteString("Starting test number " + strconv.Itoa(sequence))

	testNetwork(&pr, pi, conn)
	testInternet(&pr, pi, conn)
	// testDNS(&pr, pi, conn)

	logger.WriteString("Finished test number " + strconv.Itoa(sequence))

	sequence++
	return pr
}
Example #2
0
// Loads the settings from the config file
func buildConfigStruct(cp *configPage) {
	cp.DeviceIP = configuration.GetDeviceIP()
	cp.Port = configuration.GetPortNumber()
	cp.InternalAddr = configuration.GetInternalIPs()
	cp.ExternalAddr = configuration.GetExternalIPs()
	cp.ExternalURL = configuration.GetExternalURLs()
	cp.SpeedFileLoc = configuration.GetSpeedFileLocation()
	cp.ReportFileLoc = configuration.GetReportsLocation()
	cp.PingDelay = configuration.GetPingDelay()
	cp.SpeedDelay = configuration.GetSpeedDelay()
}