diff options
author | Kegsay <kegan@matrix.org> | 2020-06-04 15:43:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 15:43:07 +0100 |
commit | 9834ac97db042b0c78fbd72652aa534129ca3afe (patch) | |
tree | 4fd862ffba61e47f94b2fcc5685a0502e21b3c70 /internal | |
parent | d785ad82b996989381657292fbd2c28b9fbb7df6 (diff) |
Convert everything but serverkeyapi to inthttp (#1096)
* Convert roomserver to new inthttp format
* Convert eduserver to new inthttp format
* Convert appservice to new inthttp format
Diffstat (limited to 'internal')
-rw-r--r-- | internal/basecomponent/base.go | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/internal/basecomponent/base.go b/internal/basecomponent/base.go index a1a90876..cd297b82 100644 --- a/internal/basecomponent/base.go +++ b/internal/basecomponent/base.go @@ -36,11 +36,14 @@ import ( "github.com/gorilla/mux" appserviceAPI "github.com/matrix-org/dendrite/appservice/api" + asinthttp "github.com/matrix-org/dendrite/appservice/inthttp" eduServerAPI "github.com/matrix-org/dendrite/eduserver/api" + eduinthttp "github.com/matrix-org/dendrite/eduserver/inthttp" federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api" - "github.com/matrix-org/dendrite/federationsender/inthttp" + fsinthttp "github.com/matrix-org/dendrite/federationsender/inthttp" "github.com/matrix-org/dendrite/internal/config" roomserverAPI "github.com/matrix-org/dendrite/roomserver/api" + rsinthttp "github.com/matrix-org/dendrite/roomserver/inthttp" serverKeyAPI "github.com/matrix-org/dendrite/serverkeyapi/api" "github.com/sirupsen/logrus" @@ -136,32 +139,29 @@ func (b *BaseDendrite) Close() error { return b.tracerCloser.Close() } -// CreateHTTPAppServiceAPIs returns the QueryAPI for hitting the appservice -// component over HTTP. -func (b *BaseDendrite) CreateHTTPAppServiceAPIs() appserviceAPI.AppServiceQueryAPI { - a, err := appserviceAPI.NewAppServiceQueryAPIHTTP(b.Cfg.AppServiceURL(), b.httpClient) +// AppserviceHTTPClient returns the AppServiceQueryAPI for hitting the appservice component over HTTP. +func (b *BaseDendrite) AppserviceHTTPClient() appserviceAPI.AppServiceQueryAPI { + a, err := asinthttp.NewAppserviceClient(b.Cfg.AppServiceURL(), b.httpClient) if err != nil { logrus.WithError(err).Panic("CreateHTTPAppServiceAPIs failed") } return a } -// CreateHTTPRoomserverAPIs returns the AliasAPI, InputAPI and QueryAPI for hitting -// the roomserver over HTTP. -func (b *BaseDendrite) CreateHTTPRoomserverAPIs() roomserverAPI.RoomserverInternalAPI { - rsAPI, err := roomserverAPI.NewRoomserverInternalAPIHTTP(b.Cfg.RoomServerURL(), b.httpClient, b.ImmutableCache) +// RoomserverHTTPClient returns RoomserverInternalAPI for hitting the roomserver over HTTP. +func (b *BaseDendrite) RoomserverHTTPClient() roomserverAPI.RoomserverInternalAPI { + rsAPI, err := rsinthttp.NewRoomserverClient(b.Cfg.RoomServerURL(), b.httpClient, b.ImmutableCache) if err != nil { - logrus.WithError(err).Panic("NewRoomserverInternalAPIHTTP failed", b.httpClient) + logrus.WithError(err).Panic("RoomserverHTTPClient failed", b.httpClient) } return rsAPI } -// CreateHTTPEDUServerAPIs returns eduInputAPI for hitting the EDU -// server over HTTP -func (b *BaseDendrite) CreateHTTPEDUServerAPIs() eduServerAPI.EDUServerInputAPI { - e, err := eduServerAPI.NewEDUServerInputAPIHTTP(b.Cfg.EDUServerURL(), b.httpClient) +// EDUServerClient returns EDUServerInputAPI for hitting the EDU server over HTTP +func (b *BaseDendrite) EDUServerClient() eduServerAPI.EDUServerInputAPI { + e, err := eduinthttp.NewEDUServerClient(b.Cfg.EDUServerURL(), b.httpClient) if err != nil { - logrus.WithError(err).Panic("NewEDUServerInputAPIHTTP failed", b.httpClient) + logrus.WithError(err).Panic("EDUServerClient failed", b.httpClient) } return e } @@ -169,9 +169,9 @@ func (b *BaseDendrite) CreateHTTPEDUServerAPIs() eduServerAPI.EDUServerInputAPI // FederationSenderHTTPClient returns FederationSenderInternalAPI for hitting // the federation sender over HTTP func (b *BaseDendrite) FederationSenderHTTPClient() federationSenderAPI.FederationSenderInternalAPI { - f, err := inthttp.NewFederationSenderClient(b.Cfg.FederationSenderURL(), b.httpClient) + f, err := fsinthttp.NewFederationSenderClient(b.Cfg.FederationSenderURL(), b.httpClient) if err != nil { - logrus.WithError(err).Panic("NewFederationSenderInternalAPIHTTP failed", b.httpClient) + logrus.WithError(err).Panic("FederationSenderHTTPClient failed", b.httpClient) } return f } |