mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-18 15:50:52 +01:00
ec716793eb
* Initial federation sender -> federation API refactoring * Move base into own package, avoids import cycle * Fix build errors * Fix tests * Add signing key server tables * Try to fold signing key server into federation API * Fix dendritejs builds * Update embedded interfaces * Fix panic, fix lint error * Update configs, docker * Rename some things * Reuse same keyring on the implementing side * Fix federation tests, `NewBaseDendrite` can accept freeform options * Fix build * Update create_db, configs * Name tables back * Don't rename federationsender consumer for now
32 lines
816 B
Go
32 lines
816 B
Go
package base
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"net"
|
|
"net/http"
|
|
)
|
|
|
|
// noOpHTTPTransport is used to disable federation.
|
|
var noOpHTTPTransport = &http.Transport{
|
|
Dial: func(_, _ string) (net.Conn, error) {
|
|
return nil, fmt.Errorf("federation prohibited by configuration")
|
|
},
|
|
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
|
|
return nil, fmt.Errorf("federation prohibited by configuration")
|
|
},
|
|
DialTLS: func(_, _ string) (net.Conn, error) {
|
|
return nil, fmt.Errorf("federation prohibited by configuration")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
noOpHTTPTransport.RegisterProtocol("matrix", &noOpHTTPRoundTripper{})
|
|
}
|
|
|
|
type noOpHTTPRoundTripper struct {
|
|
}
|
|
|
|
func (y *noOpHTTPRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|
return nil, fmt.Errorf("federation prohibited by configuration")
|
|
}
|