Skip to content
Snippets Groups Projects
Commit 78d174c6 authored by Hans Moog's avatar Hans Moog
Browse files

Feat: added flags to disable autopeering for entry nodes

parent 7d4d5612
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,9 @@ package parameters
import "github.com/iotaledger/goshimmer/packages/parameter"
var (
ADDRESS = parameter.AddString("AUTOPEERING/ADDRESS", "0.0.0.0", "address to bind for incoming peering requests")
ENTRY_NODES = parameter.AddString("AUTOPEERING/ENTRY_NODES", "0d828930890386f036eb77982cc067c5429f7b8f@82.165.29.179:14626", "list of trusted entry nodes for auto peering")
PORT = parameter.AddInt("AUTOPEERING/PORT", 14626, "tcp port for incoming peering requests")
ADDRESS = parameter.AddString("AUTOPEERING/ADDRESS", "0.0.0.0", "address to bind for incoming peering requests")
ENTRY_NODES = parameter.AddString("AUTOPEERING/ENTRY_NODES", "0d828930890386f036eb77982cc067c5429f7b8f@82.165.29.179:14626", "list of trusted entry nodes for auto peering")
PORT = parameter.AddInt("AUTOPEERING/PORT", 14626, "tcp port for incoming peering requests")
ACCEPT_REQUESTS = parameter.AddBool("AUTOPEERING/ACCEPT_REQUESTS", true, "accept incoming autopeering requests")
SEND_REQUESTS = parameter.AddBool("AUTOPEERING/SEND_REQUESTS", true, "send autopeering requests")
)
......@@ -3,6 +3,8 @@ package protocol
import (
"math/rand"
"github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
"github.com/iotaledger/goshimmer/packages/events"
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/plugins/autopeering/instances/acceptedneighbors"
......@@ -25,7 +27,7 @@ func processIncomingRequest(plugin *node.Plugin, req *request.Request) {
knownpeers.INSTANCE.AddOrUpdate(req.Issuer)
if requestShouldBeAccepted(req) {
if *parameters.ACCEPT_REQUESTS.Value && requestShouldBeAccepted(req) {
defer acceptedneighbors.INSTANCE.Lock()()
if requestShouldBeAccepted(req) {
......
package protocol
import (
"fmt"
"github.com/iotaledger/goshimmer/packages/daemon"
"github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
"github.com/iotaledger/goshimmer/plugins/autopeering/server/tcp"
"github.com/iotaledger/goshimmer/plugins/autopeering/server/udp"
)
......@@ -22,6 +25,13 @@ func Configure(plugin *node.Plugin) {
func Run(plugin *node.Plugin) {
daemon.BackgroundWorker("Autopeering Chosen Neighbor Dropper", createChosenNeighborDropper(plugin))
daemon.BackgroundWorker("Autopeering Accepted Neighbor Dropper", createAcceptedNeighborDropper(plugin))
daemon.BackgroundWorker("Autopeering Outgoing Request Processor", createOutgoingRequestProcessor(plugin))
fmt.Println(*parameters.SEND_REQUESTS.Value)
fmt.Println(*parameters.ACCEPT_REQUESTS.Value)
if *parameters.SEND_REQUESTS.Value {
daemon.BackgroundWorker("Autopeering Outgoing Request Processor", createOutgoingRequestProcessor(plugin))
}
daemon.BackgroundWorker("Autopeering Outgoing Ping Processor", createOutgoingPingProcessor(plugin))
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment