mirror of
https://github.com/matrix-org/dendrite
synced 2024-12-13 15:53:16 +01:00
b5aa7ca3ab
* Move config, setup, mscs into "setup" top-level folder * oops, forgot the EDU server * Add setup * goimports
32 lines
817 B
Go
32 lines
817 B
Go
package setup
|
|
|
|
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")
|
|
}
|