mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-25 15:51:55 -06:00
6cd1285ca0
This PR adds 2 `dendrite-demo` main's, each designed expressly to serve a Hidden Service/Overlay network. The first, `dendrite-demo-i2p` add self-configuration for use of dendrite as an I2P hidden service(eepsite) and to connect to I2P services(federate) as an I2P client. It further disables the `dendrite` server from communicating with non-anonymous servers by federation(because I2P does not canonically have the ability to exit, we rely on donors for exit traffic), and enables the use of self-signed TLS certificates([because I2P services are self-authenticating but TLS is still required for other aspects of the system to work reliably](https://tor.stackexchange.com/questions/13887/registering-onion-with-certificate-authority)). This demo turns the system into an "pseudonymous" homeserver which people can connect to using an I2P-enabled Matrix client(I like `cinny` and it's what I tested with). The second, `dendrite-demo-tor` adds self-configuration for the use of dendrite as an Onion service and to connect to other onion services and non-anonymous web sites using Tor to obfuscate it's physical location and providing, optionally, pseudonymity. It also enables the use of self-signed TLS certificates, for the same reason as with I2P, because onion services aren't typically eligible for TLS certificates. It has also been tested with `cinny`. These services are both pseudonymous like myself, not anonymous. I will be meeting members of the element team at the CCC assembly shortly to discuss contributing under my pseudonym. As none of the other `dendrite-demo` have unit tests I did not add them to these checkins. * [*] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests --------- Co-authored-by: eyedeekay <idk@mulder> Co-authored-by: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"strings"
|
|
"syscall"
|
|
"testing"
|
|
)
|
|
|
|
// This is an instrumented main, used when running integration tests (sytest) with code coverage.
|
|
// Compile: go test -c -race -cover -covermode=atomic -o monolith.debug -coverpkg "github.com/matrix-org/..." ./cmd/dendrite
|
|
// Run the monolith: ./monolith.debug -test.coverprofile=/somewhere/to/dump/integrationcover.out DEVEL --config dendrite.yaml
|
|
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
|
|
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
|
|
func TestMain(t *testing.T) {
|
|
var args []string
|
|
|
|
for _, arg := range os.Args {
|
|
switch {
|
|
case strings.HasPrefix(arg, "DEVEL"):
|
|
case strings.HasPrefix(arg, "-test"):
|
|
default:
|
|
args = append(args, arg)
|
|
}
|
|
}
|
|
|
|
// only run the tests if there are args to be passed
|
|
if len(args) <= 1 {
|
|
return
|
|
}
|
|
t.Log(args)
|
|
|
|
waitCh := make(chan int, 1)
|
|
os.Args = args
|
|
go func() {
|
|
main()
|
|
close(waitCh)
|
|
}()
|
|
|
|
signalCh := make(chan os.Signal, 1)
|
|
signal.Notify(signalCh, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGHUP)
|
|
|
|
select {
|
|
case <-signalCh:
|
|
return
|
|
case <-waitCh:
|
|
return
|
|
}
|
|
}
|