From bd2881d85ce02d239ca909b9b5c844651289e807 Mon Sep 17 00:00:00 2001 From: forrestjgq Date: Fri, 29 Apr 2022 10:54:11 +0800 Subject: [PATCH] export api for enable/disable server --- mark.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mark.go b/mark.go index 40d1304..231dcaf 100644 --- a/mark.go +++ b/mark.go @@ -16,10 +16,10 @@ package gomark import ( + "github.com/forrestjgq/glog" "github.com/forrestjgq/gomark/gmi" "github.com/forrestjgq/gomark/internal/gm" "github.com/forrestjgq/gomark/internal/httpsrv" - "github.com/forrestjgq/glog" ) // StartHTTPServer will create an http server for gomark. @@ -37,6 +37,16 @@ func Request(req *gmi.Request) *gmi.Response { return httpsrv.RequestHTTP(req) } +// EnableServer will make server accept all marks +func EnableServer() { + gm.EnableServer() +} + +// DisableServer will make server reject all marks +func DisableServer() { + gm.DisableServer() +} + // NewLatencyRecorder create a latency recorder. func NewLatencyRecorder(name string) gmi.Marker { var ret gmi.Marker