Major refactoring of the code base into Backend structure. Increase version number to Alpha 6 to prepare for the upcoming release.

This commit is contained in:
Kleissner
2021-12-29 05:29:34 +01:00
parent ade13d6422
commit f2c344dc96
40 changed files with 642 additions and 649 deletions

View File

@@ -35,25 +35,26 @@ type Networks struct {
// localFirewall indicates if a local firewall may drop unsolicited incoming packets
localFirewall bool
// backend
backend *Backend
}
// ReplyTimeout is the round-trip timeout for message sequences.
const ReplyTimeout = 20
var networks *Networks
func (backend *Backend) initMessageSequence() {
backend.networks = &Networks{backend: backend}
func initMessageSequence() {
networks = &Networks{}
backend.networks.rawPacketsIncoming = make(chan networkWire, 1000) // buffer up to 1000 UDP packets before they get buffered by the OS network stack and eventually dropped
networks.rawPacketsIncoming = make(chan networkWire, 1000) // buffer up to 1000 UDP packets before they get buffered by the OS network stack and eventually dropped
backend.networks.Sequences = protocol.NewSequenceManager(ReplyTimeout)
networks.Sequences = protocol.NewSequenceManager(ReplyTimeout)
networks.ipListen = NewIPList()
backend.networks.ipListen = NewIPList()
// There is currently no suitable live firewall detection code. Instead, there is the config flag.
// Windows: If the user runs as non-admin, it can be assumed that the Windows Firewall creates a rule to drop unsolicited incoming packets.
// Changing the Windows Firewall (via netsh or otherwise) requires elevated admin rights.
// This flag will be passed on to other peers to indicate that uncontacted peers shall use the Traverse message for establishing connections.
networks.localFirewall = config.LocalFirewall
backend.networks.localFirewall = backend.Config.LocalFirewall
}