mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
Listen for fetch traffic rather than HTTP
This commit is contained in:
parent
1cba9cbc2a
commit
bf6aa8cfd5
|
|
@ -444,7 +444,8 @@ func Register(
|
|||
deviceDB devices.Database,
|
||||
cfg *config.Dendrite,
|
||||
) util.JSONResponse {
|
||||
|
||||
logger := util.GetLogger(req.Context())
|
||||
logger.Info("Incoming request info: " + fmt.Sprintf("%+v", req))
|
||||
var r registerRequest
|
||||
resErr := httputil.UnmarshalJSONRequest(req, &r)
|
||||
if resErr != nil {
|
||||
|
|
@ -499,7 +500,6 @@ func Register(
|
|||
}
|
||||
}
|
||||
|
||||
logger := util.GetLogger(req.Context())
|
||||
logger.WithFields(log.Fields{
|
||||
"username": r.Username,
|
||||
"auth.type": r.Auth.Type,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/syncapi"
|
||||
"github.com/matrix-org/dendrite/typingserver"
|
||||
"github.com/matrix-org/dendrite/typingserver/cache"
|
||||
"github.com/matrix-org/go-http-js-libp2p/go_http_js_libp2p"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
|
|
@ -109,17 +110,12 @@ func main() {
|
|||
|
||||
http.Handle("/", httpHandler)
|
||||
|
||||
// Expose the matrix APIs directly rather than putting them under a /api path.
|
||||
go func() {
|
||||
logrus.Info("Listening on ", *httpBindAddr)
|
||||
logrus.Fatal(http.ListenAndServe(*httpBindAddr, nil))
|
||||
}()
|
||||
// Handle HTTPS if certificate and key are provided
|
||||
go func() {
|
||||
if *certFile != "" && *keyFile != "" {
|
||||
logrus.Info("Listening on ", *httpsBindAddr)
|
||||
logrus.Fatal(http.ListenAndServeTLS(*httpsBindAddr, *certFile, *keyFile, nil))
|
||||
}
|
||||
logrus.Info("Listening for service-worker fetch traffic")
|
||||
|
||||
listener := go_http_js_libp2p.NewFetchListener()
|
||||
s := &http.Server{}
|
||||
go s.Serve(listener)
|
||||
}()
|
||||
|
||||
// We want to block forever to let the HTTP and HTTPS handler serve the APIs
|
||||
|
|
|
|||
1
go.mod
1
go.mod
|
|
@ -17,6 +17,7 @@ require (
|
|||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
github.com/lib/pq v1.2.0
|
||||
github.com/matrix-org/dugong v0.0.0-20171220115018-ea0a4690a0d5
|
||||
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200126031050-234d7bbbff9a
|
||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20200225115056-c0aef2609ba2
|
||||
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26
|
||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20200124100636-0c2ec91d1df5
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -65,6 +65,8 @@ github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
|
|||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/matrix-org/dugong v0.0.0-20171220115018-ea0a4690a0d5 h1:nMX2t7hbGF0NYDYySx0pCqEKGKAeZIiSqlWSspetlhY=
|
||||
github.com/matrix-org/dugong v0.0.0-20171220115018-ea0a4690a0d5/go.mod h1:NgPCr+UavRGH6n5jmdX8DuqFZ4JiCWIJoZiuhTRLSUg=
|
||||
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200126031050-234d7bbbff9a h1:ZsaauiZcUC8lCE0iZ/Oc/LYMEZDkJLSWTpzleAD662I=
|
||||
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200126031050-234d7bbbff9a/go.mod h1:3WluEZ9QXSwU30tWYqktnpC1x9mwZKx1r8uAv8Iq+a4=
|
||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20200220181445-d8f0009820f1 h1:vFk1IC6gbT+1p+/BgtSwzy5rpI1KGskOvMZxLKSGeho=
|
||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20200220181445-d8f0009820f1/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
|
||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20200222210301-d686541685d3 h1:pV+1GBKVN4dLkpavy9LXwlemTX2FN4Zw7pSEpbVoPdw=
|
||||
|
|
|
|||
Loading…
Reference in a new issue