diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2023-08-13 14:13:30 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2023-08-13 14:13:30 +0100 |
| commit | 8b3b5c23b098d9f3cf2737ddad4f7c1d26aad23d (patch) | |
| tree | c16d4b9fd805e12f14516b8d9380727edbd9944e /main.go | |
| parent | 1e6fd3c1dd03f52137205f3e66f6dee20ac4fe17 (diff) | |
Use go.awhk.org/core instead of Gorilla
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -14,9 +14,7 @@ import ( "syscall" "time" - "github.com/gorilla/handlers" - "github.com/gorilla/mux" - + "go.awhk.org/core" "go.awhk.org/fwdsms/pkg/twilio" "go.awhk.org/gosdd" ) @@ -43,18 +41,17 @@ func main() { sms := make(chan twilio.SMS) - r := mux.NewRouter() - r.Path(cfg.Twilio.Endpoint). - Methods(http.MethodPost). - Handler(handlers.ProxyHeaders(&twilio.Filter{ - AuthToken: []byte(cfg.Twilio.AuthToken), - Handler: &twilio.SMSTee{ - Chan: sms, - Handler: twilio.EmptyResponseHandler, - }, - })) + h := core.FilteringHTTPHandler(&twilio.Filter{ + AuthToken: []byte(cfg.Twilio.AuthToken), + Handler: &twilio.SMSTee{ + Chan: sms, + Handler: twilio.EmptyResponseHandler, + }, + }, core.FilterHTTPMethod(http.MethodPost)) + m := http.NewServeMux() + m.Handle(cfg.Twilio.Endpoint, h) - srv := http.Server{Handler: r} + srv := http.Server{Handler: m} go func() { ln, err := listenSD() if err != nil { |
