mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
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:
17
Networks.go
17
Networks.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user