mumble-voip / grumble

Alternative Mumble server
http://mumble.info/grumble
Other
280 stars 87 forks source link

Can we separate Server out into it's own pkg, and also make it use net.Conn/net.PacketConn/net.Addr interfaces rather than structs #75

Open eyedeekay opened 3 years ago

eyedeekay commented 3 years ago

I'm interested in using Grumble to set up an anonymous mumble server on the I2P network using the SAM API. In Go, the most convenient and natural way to interface with I2P is by implementing the required interfaces from "net" which is what the library sam3 does. But I see that the Server itself is actually in package main where it can't be imported by another project, and moreover that it uses a net.TCPListener and net.UDPConn, and in several places expects a net.TCPAddr or net.UDPAddr rather than a net.Addr. In order to be compatible with I2P, it needs to be compatible with other expectations*. I would like to make the Server a separate, importable package under /pkg/server/ with the name grumble and make it compatible with the following changes:

Change net.TCPListener to net.Listener in order to make it compatible with Tor Onion Services via cretz/bine and I2P Services via eyedeekay/sam3. Use a type-switch to determine which is in use at runtime.

Change net.UDPConn to net.PacketConn in order to make it compatible with I2P Services via eyedeekay/sam3. Since Tor is not able to do UDP communication, bine compatibility won't be a goal here.

Change net.TCPAddr's and net.UDPAddr's into net.Addr's in order to make them compatible with Tor addresses via cretz/bine and I2P addresses via eyedeekay/sam3. Implement saving and loading hidden service keys from disk in ~/.grumble.

This would allow other applications to import the Server wholesale, set up the server with a ServerConf how they like it, configure the connections they want to make/accept(Tor, I2P, TLS, whatever), and then have their own grumble servers ready to go with very little configuration. As a bonus, since Tor and I2P addresses use cryptographic addresses that are basically permanent and designed to be addressable from anywhere with the overlay network software, people using hidden Grumble would have no need for a static IP, it could easily run without needing permission to bind to port 443, on a residential connection, with no other configuration to be reachable.

It seems to be well within reach, I just chopped it up and moved some stuff around here: https://github.com/mumble-voip/grumble/compare/master...eyedeekay:master to see if it was possible. Is this something that Grumble would be interested in?