From d207f6430ae9ed36e7f6c2c5c563a108ae6db051 Mon Sep 17 00:00:00 2001 From: Lyas Spiehler Date: Wed, 1 Feb 2023 12:33:28 +0000 Subject: [PATCH] remove unnecessary function and inline assignment Signed-off-by: Lyas Spiehler --- prober/handler.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/prober/handler.go b/prober/handler.go index 830c8572..2a8a1d9c 100644 --- a/prober/handler.go +++ b/prober/handler.go @@ -108,10 +108,8 @@ func Handler(w http.ResponseWriter, r *http.Request, c *config.Config, logger lo } if module.Prober == "tcp" && hostname != "" { - err = setTLSServerName(hostname, &module) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return + if module.TCP.TLSConfig.ServerName == "" { + module.TCP.TLSConfig.ServerName = hostname } } @@ -145,15 +143,6 @@ func Handler(w http.ResponseWriter, r *http.Request, c *config.Config, logger lo h.ServeHTTP(w, r) } -func setTLSServerName(hostname string, module *config.Module) error { - // By creating a new hashmap and copying values there we - // ensure that the initial configuration remain intact. - if module.TCP.TLSConfig.ServerName == "" { - module.TCP.TLSConfig.ServerName = hostname - } - return nil -} - func setHTTPHost(hostname string, module *config.Module) error { // By creating a new hashmap and copying values there we // ensure that the initial configuration remain intact.