mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Top-level setup package (#1605)
* Move config, setup, mscs into "setup" top-level folder * oops, forgot the EDU server * Add setup * goimports
This commit is contained in:
parent
3ef6187e96
commit
b5aa7ca3ab
174 changed files with 196 additions and 196 deletions
32
setup/federation.go
Normal file
32
setup/federation.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
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")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue