Skip to content

Commit

Permalink
remove gorilla/mux dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
joonas-fi committed Sep 16, 2024
1 parent bcb4f46 commit 32bddb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
9 changes: 4 additions & 5 deletions cmd/dyndns/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/function61/gokit/net/http/ezhttp"
"github.com/function61/gokit/net/http/httputils"
"github.com/function61/gokit/os/osutil"
"github.com/gorilla/mux"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -106,9 +105,9 @@ func newServerHandler() (http.Handler, error) {
return nil, err
}

routes := mux.NewRouter()
routes.HandleFunc("/dyndns/api/hostname/{hostname}", func(w http.ResponseWriter, r *http.Request) {
hostname := mux.Vars(r)["hostname"]
routes := http.NewServeMux()
routes.HandleFunc("PUT /dyndns/api/hostname/{hostname}", func(w http.ResponseWriter, r *http.Request) {
hostname := r.PathValue("hostname")

if err := updateTokenValidator.ValidateUpdateToken(hostname, getBearerToken(r)); err != nil {
http.Error(w, err.Error(), http.StatusForbidden)
Expand Down Expand Up @@ -153,7 +152,7 @@ func newServerHandler() (http.Handler, error) {
}

w.WriteHeader(http.StatusOK)
}).Methods(http.MethodPut)
})

return routes, nil
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22
require (
github.com/aws/aws-lambda-go v1.47.0
github.com/function61/gokit v0.0.0-20240419102346-a5f721139a62
github.com/gorilla/mux v1.8.0
github.com/spf13/cobra v1.6.1
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/function61/gokit v0.0.0-20240419102346-a5f721139a62 h1:COUqRRf8I+PpzfrndXgyUtJMxg+mxVFs+sjheSXDORA=
github.com/function61/gokit v0.0.0-20240419102346-a5f721139a62/go.mod h1:sJY957+7ush4oj4ElOMhUFaFIriAFNAGYzVh2tFJNy0=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
Expand Down

0 comments on commit 32bddb9

Please sign in to comment.