rrda

REST API allowing to perform DNS queries over HTTP
Log | Files | Refs | README | LICENSE

commit 2809271f95d4a32da37e4541e524acfa3242eabe
parent e5daa29ed3338d163f37cd8f312bac6e72b7d738
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 21 Nov 2022 11:29:19 +0100

Refactor error handling for http.ListenAndServe().

Diffstat:
Mrrda.go | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/rrda.go b/rrda.go @@ -4,7 +4,7 @@ * https://www.statdns.com * * Created: 2012-03-11 - * Last Updated: 2022-01-14 + * Last Updated: 2022-11-21 * * RRDA is released under the BSD 2-Clause license. * See LICENSE file for details. @@ -22,6 +22,7 @@ import ( "github.com/miekg/dns" "golang.org/x/net/idna" "io" + "log" "net" "net/http" "os" @@ -191,10 +192,7 @@ func main() { r.Get("/{server}/x/{ip}", ptr) r.Get("/{server}/{domain}/{querytype}", query) - if err := http.ListenAndServe(address, r); err != nil { - fmt.Println("\nERROR:", err) - os.Exit(1) - } + log.Fatal(http.ListenAndServe(address, r)) fmt.Println("Listening on:", address) }