Skip to content

Commit 205a579

Browse files
committed
Removing httprouter
1 parent 2cf1034 commit 205a579

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

Gopkg.lock

Lines changed: 1 addition & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"sync/atomic"
1717
"time"
1818

19-
"github.com/julienschmidt/httprouter"
2019
"go4.org/strutil"
2120
)
2221

@@ -53,9 +52,13 @@ func main() {
5352
if *yGen == 0 || *tGen == 0 {
5453
log.Fatalf("Neither ygen nor tgen can be 0. ygen:%d tgen:%d", *yGen, *tGen)
5554
}
56-
router := httprouter.New()
57-
router.HandlerFunc("GET", "/", newProxy(*redirectURL, *yGen, *tGen, *printGC))
58-
log.Fatal(http.ListenAndServe(":"+*port, router))
55+
srv := &http.Server{
56+
ReadTimeout: 5 * time.Second,
57+
WriteTimeout: 5 * time.Second,
58+
Handler: newProxy(*redirectURL, *yGen, *tGen, *printGC),
59+
Addr: ":" + *port,
60+
}
61+
log.Fatal(srv.ListenAndServe())
5962
}
6063

6164
const (

0 commit comments

Comments
 (0)