Skip to content

Commit

Permalink
remove unnecessary function and inline assignment
Browse files Browse the repository at this point in the history
Signed-off-by: Lyas Spiehler <[email protected]>
  • Loading branch information
lspiehler committed Feb 1, 2023
1 parent 4cde588 commit d207f64
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions prober/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit d207f64

Please sign in to comment.