aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2023-08-13 14:13:30 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2023-08-13 14:13:30 +0100
commit8b3b5c23b098d9f3cf2737ddad4f7c1d26aad23d (patch)
treec16d4b9fd805e12f14516b8d9380727edbd9944e /main.go
parent1e6fd3c1dd03f52137205f3e66f6dee20ac4fe17 (diff)
Use go.awhk.org/core instead of Gorilla
Diffstat (limited to 'main.go')
-rw-r--r--main.go25
1 files changed, 11 insertions, 14 deletions
diff --git a/main.go b/main.go
index bb210c9..9876d6d 100644
--- a/main.go
+++ b/main.go
@@ -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 {