From fa647c6645f74e3c0e6fded658f5f8b5882b0e01 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Wed, 4 May 2022 10:45:06 -0400 Subject: Fully support self-signed certificates (and add debug levels) Two unrelated changes: 1. Add full support for self-signed HTTPS certificates on the server 2. Add support for multiple log levels: So far we only use one, but adding support for additional levels will help us tier the levels to filter out excessive messages. --- utilities/utilities.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'utilities') diff --git a/utilities/utilities.go b/utilities/utilities.go index 46d5766..b8e416c 100644 --- a/utilities/utilities.go +++ b/utilities/utilities.go @@ -22,6 +22,8 @@ import ( "os" "reflect" "time" + + "github.com/network-quality/goresponsiveness/constants" ) func IsInterfaceNil(ifc interface{}) bool { @@ -121,3 +123,24 @@ func SeekForAppend(file *os.File) (err error) { _, err = file.Seek(0, 2) return } + +func IsDebug(level constants.DebugLevel) bool { + if level <= constants.Debug { + return true + } + return false +} + +func IsWarn(level constants.DebugLevel) bool { + if level <= constants.Warn { + return true + } + return false +} + +func IsError(level constants.DebugLevel) bool { + if level <= constants.Error { + return true + } + return false +} -- cgit v1.2.3