mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
New flag Firewall in the Features field to inform uncontacted peers that a Traverse message might be required to establish a connection. Close #61
This flag can be activated via the config setting LocalFirewall. The Features field exists in Announcement/Response messages and was now added to peer records.
This commit is contained in:
@@ -171,6 +171,7 @@ func (nets *Networks) packetWorker() {
|
||||
// Update known internal/external port and User Agent
|
||||
connection.PortInternal = announce.PortInternal
|
||||
connection.PortExternal = announce.PortExternal
|
||||
connection.Firewall = announce.Features&(1<<protocol.FeatureFirewall) > 0
|
||||
if len(announce.UserAgent) > 0 {
|
||||
peer.UserAgent = announce.UserAgent
|
||||
}
|
||||
@@ -199,6 +200,7 @@ func (nets *Networks) packetWorker() {
|
||||
// Update known internal/external port and User Agent
|
||||
connection.PortInternal = response.PortInternal
|
||||
connection.PortExternal = response.PortExternal
|
||||
connection.Firewall = response.Features&(1<<protocol.FeatureFirewall) > 0
|
||||
if len(response.UserAgent) > 0 {
|
||||
peer.UserAgent = response.UserAgent
|
||||
}
|
||||
@@ -359,5 +361,8 @@ func FeatureSupport() (feature byte) {
|
||||
if networks.countListen6 > 0 {
|
||||
feature |= 1 << protocol.FeatureIPv6Listen
|
||||
}
|
||||
if networks.localFirewall {
|
||||
feature |= 1 << protocol.FeatureFirewall
|
||||
}
|
||||
return feature
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user