From 36285a6749cddcc648190330ef9a8003a255ab85 Mon Sep 17 00:00:00 2001
From: Hans Moog <hm@mkjc.net>
Date: Fri, 12 Apr 2019 10:01:42 +0200
Subject: [PATCH] Refactor: refactored autopeering module

---
 .../chosenneighborcandidates/instance.go      | 28 ++++++++
 .../entrynodes/instance.go}                   | 26 ++-----
 .../instances/knownpeers/instance.go          | 17 +++++
 .../neighborhood}/events.go                   |  8 +--
 .../instances/neighborhood/instance.go        | 45 +++++++++++++
 .../instances/outgoingrequest/instance.go     | 21 ++++++
 .../autopeering/instances/ownpeer/instance.go | 17 +++++
 plugins/autopeering/parameters/parameters.go  |  5 +-
 .../peermanager/chosen_neighbor_candidates.go | 25 -------
 .../autopeering/peermanager/known_peers.go    | 16 -----
 .../autopeering/peermanager/neighborhood.go   | 42 ------------
 plugins/autopeering/plugin.go                 | 10 +--
 .../protocol/constants/constants.go           | 13 +++-
 plugins/autopeering/protocol/events.go        |  6 +-
 .../protocol/incoming_ping_processor.go       |  2 +-
 .../protocol/incoming_request_processor.go    | 15 +++--
 .../protocol/incoming_response_processor.go   |  2 +-
 .../protocol/outgoing_ping_processor.go       | 50 ++++++++------
 ...essor.go => outgoing_request_processor.go} | 29 ++++----
 plugins/autopeering/protocol/plugin.go        |  2 +-
 plugins/autopeering/protocol/request/send.go  | 51 --------------
 plugins/autopeering/saltmanager/events.go     |  2 +-
 .../autopeering/saltmanager/saltmanager.go    |  2 +-
 plugins/autopeering/saltmanager/types.go      |  2 +-
 plugins/autopeering/saltmanager/utils.go      |  2 +-
 plugins/autopeering/server/tcp/events.go      |  6 +-
 plugins/autopeering/server/tcp/server.go      | 16 ++---
 plugins/autopeering/server/tcp/types.go       |  6 +-
 plugins/autopeering/server/udp/events.go      |  6 +-
 plugins/autopeering/server/udp/server.go      | 18 ++---
 plugins/autopeering/server/udp/types.go       |  6 +-
 .../{protocol => types}/peer/constants.go     | 12 +---
 .../{protocol => types}/peer/peer.go          | 67 ++++++++++---------
 .../types => types/peerlist}/peer_list.go     |  4 +-
 .../peerregister}/peer_register.go            | 11 +--
 .../{protocol => types}/ping/constants.go     |  2 +-
 .../{protocol => types}/ping/errors.go        |  0
 .../{protocol => types}/ping/ping.go          |  5 +-
 .../{protocol => types}/request/constants.go  |  2 +-
 .../{protocol => types}/request/errors.go     |  0
 .../{protocol => types}/request/request.go    | 14 ++--
 .../{protocol => types}/response/constants.go |  2 +-
 .../{protocol => types}/response/errors.go    |  0
 .../{protocol => types}/response/response.go  |  2 +-
 .../{protocol => types}/response/types.go     |  0
 .../{protocol => types}/salt/constants.go     |  0
 .../{protocol => types}/salt/salt.go          |  0
 .../neighbormanager/accepted_neighbors.go     |  4 +-
 .../neighbormanager/chosen_neighbors.go       |  4 +-
 plugins/statusscreen/ui_header_bar.go         |  5 +-
 50 files changed, 312 insertions(+), 318 deletions(-)
 create mode 100644 plugins/autopeering/instances/chosenneighborcandidates/instance.go
 rename plugins/autopeering/{peermanager/entry_nodes.go => instances/entrynodes/instance.go} (68%)
 create mode 100644 plugins/autopeering/instances/knownpeers/instance.go
 rename plugins/autopeering/{peermanager => instances/neighborhood}/events.go (77%)
 create mode 100644 plugins/autopeering/instances/neighborhood/instance.go
 create mode 100644 plugins/autopeering/instances/outgoingrequest/instance.go
 create mode 100644 plugins/autopeering/instances/ownpeer/instance.go
 delete mode 100644 plugins/autopeering/peermanager/chosen_neighbor_candidates.go
 delete mode 100644 plugins/autopeering/peermanager/known_peers.go
 delete mode 100644 plugins/autopeering/peermanager/neighborhood.go
 rename plugins/autopeering/protocol/{chosen_neighbor_processor.go => outgoing_request_processor.go} (63%)
 delete mode 100644 plugins/autopeering/protocol/request/send.go
 rename plugins/autopeering/{protocol => types}/peer/constants.go (66%)
 rename plugins/autopeering/{protocol => types}/peer/peer.go (67%)
 rename plugins/autopeering/{peermanager/types => types/peerlist}/peer_list.go (87%)
 rename plugins/autopeering/{peermanager/types => types/peerregister}/peer_register.go (78%)
 rename plugins/autopeering/{protocol => types}/ping/constants.go (93%)
 rename plugins/autopeering/{protocol => types}/ping/errors.go (100%)
 rename plugins/autopeering/{protocol => types}/ping/ping.go (92%)
 rename plugins/autopeering/{protocol => types}/request/constants.go (87%)
 rename plugins/autopeering/{protocol => types}/request/errors.go (100%)
 rename plugins/autopeering/{protocol => types}/request/request.go (86%)
 rename plugins/autopeering/{protocol => types}/response/constants.go (95%)
 rename plugins/autopeering/{protocol => types}/response/errors.go (100%)
 rename plugins/autopeering/{protocol => types}/response/response.go (97%)
 rename plugins/autopeering/{protocol => types}/response/types.go (100%)
 rename plugins/autopeering/{protocol => types}/salt/constants.go (100%)
 rename plugins/autopeering/{protocol => types}/salt/salt.go (100%)

diff --git a/plugins/autopeering/instances/chosenneighborcandidates/instance.go b/plugins/autopeering/instances/chosenneighborcandidates/instance.go
new file mode 100644
index 00000000..c4697d4f
--- /dev/null
+++ b/plugins/autopeering/instances/chosenneighborcandidates/instance.go
@@ -0,0 +1,28 @@
+package chosenneighborcandidates
+
+import (
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/outgoingrequest"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist"
+)
+
+var INSTANCE peerlist.PeerList
+
+var DISTANCE = func(req *request.Request) func(p *peer.Peer) float64 {
+    return func(p *peer.Peer) float64 {
+        return 1
+    }
+}
+
+func init() {
+    updateNeighborCandidates()
+
+    neighborhood.Events.Update.Attach(updateNeighborCandidates)
+}
+
+func updateNeighborCandidates() {
+    INSTANCE = neighborhood.LIST_INSTANCE.Sort(DISTANCE(outgoingrequest.INSTANCE))
+}
+
diff --git a/plugins/autopeering/peermanager/entry_nodes.go b/plugins/autopeering/instances/entrynodes/instance.go
similarity index 68%
rename from plugins/autopeering/peermanager/entry_nodes.go
rename to plugins/autopeering/instances/entrynodes/instance.go
index f7f7b22c..3d5b27a5 100644
--- a/plugins/autopeering/peermanager/entry_nodes.go
+++ b/plugins/autopeering/instances/entrynodes/instance.go
@@ -1,20 +1,19 @@
-package peermanager
+package entrynodes
 
 import (
     "github.com/iotaledger/goshimmer/packages/identity"
     "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
-    peermanagerTypes "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist"
     "net"
     "strconv"
     "strings"
 )
 
-var ENTRY_NODES = parseEntryNodes()
+var INSTANCE = parseEntryNodes()
 
-func parseEntryNodes() peermanagerTypes.PeerList {
-    result := make(peermanagerTypes.PeerList, 0)
+func parseEntryNodes() peerlist.PeerList {
+    result := make(peerlist.PeerList, 0)
 
     for _, entryNodeDefinition := range strings.Fields(*parameters.ENTRY_NODES.Value) {
         if entryNodeDefinition == "" {
@@ -25,18 +24,7 @@ func parseEntryNodes() peermanagerTypes.PeerList {
             Identity: nil,
         }
 
-        protocolBits := strings.Split(entryNodeDefinition, "://")
-        if len(protocolBits) != 2 {
-            panic("invalid entry in list of trusted entry nodes: " + entryNodeDefinition)
-        }
-        switch protocolBits[0] {
-        case "tcp":
-            entryNode.PeeringProtocolType = types.PROTOCOL_TYPE_TCP
-        case "udp":
-            entryNode.PeeringProtocolType = types.PROTOCOL_TYPE_UDP
-        }
-
-        identityBits := strings.Split(protocolBits[1], "@")
+        identityBits := strings.Split(entryNodeDefinition, "@")
         if len(identityBits) != 2 {
             panic("error while parsing identity of entry node: " + entryNodeDefinition)
         }
diff --git a/plugins/autopeering/instances/knownpeers/instance.go b/plugins/autopeering/instances/knownpeers/instance.go
new file mode 100644
index 00000000..3b5af569
--- /dev/null
+++ b/plugins/autopeering/instances/knownpeers/instance.go
@@ -0,0 +1,17 @@
+package knownpeers
+
+import (
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/entrynodes"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerregister"
+)
+
+var INSTANCE = initKnownPeers()
+
+func initKnownPeers() peerregister.PeerRegister {
+    knownPeers := make(peerregister.PeerRegister)
+    for _, entryNode := range entrynodes.INSTANCE {
+        knownPeers.AddOrUpdate(entryNode)
+    }
+
+    return knownPeers
+}
diff --git a/plugins/autopeering/peermanager/events.go b/plugins/autopeering/instances/neighborhood/events.go
similarity index 77%
rename from plugins/autopeering/peermanager/events.go
rename to plugins/autopeering/instances/neighborhood/events.go
index db39e888..3796ec2d 100644
--- a/plugins/autopeering/peermanager/events.go
+++ b/plugins/autopeering/instances/neighborhood/events.go
@@ -1,13 +1,13 @@
-package peermanager
+package neighborhood
 
 import "reflect"
 
 var Events = moduleEvents{
-    UpdateNeighborhood: &callbackEvent{make(map[uintptr]Callback)},
+    Update: &callbackEvent{make(map[uintptr]Callback)},
 }
 
 type moduleEvents struct {
-    UpdateNeighborhood *callbackEvent
+    Update *callbackEvent
 }
 
 type callbackEvent struct {
@@ -28,4 +28,4 @@ func (this *callbackEvent) Trigger() {
     }
 }
 
-type Callback = func()
\ No newline at end of file
+type Callback = func()
diff --git a/plugins/autopeering/instances/neighborhood/instance.go b/plugins/autopeering/instances/neighborhood/instance.go
new file mode 100644
index 00000000..7ce95500
--- /dev/null
+++ b/plugins/autopeering/instances/neighborhood/instance.go
@@ -0,0 +1,45 @@
+package neighborhood
+
+import (
+    "github.com/iotaledger/goshimmer/packages/timeutil"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/outgoingrequest"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerregister"
+    "time"
+)
+
+var INSTANCE peerregister.PeerRegister
+
+var LIST_INSTANCE peerlist.PeerList
+
+// Selects a fixed neighborhood from all known peers - this allows nodes to "stay in the same circles" that share their
+// view on the ledger an is a preparation for economic clustering
+var NEIGHBORHOOD_SELECTOR = func(this peerregister.PeerRegister, req *request.Request) peerregister.PeerRegister {
+    filteredPeers := make(peerregister.PeerRegister)
+    for id, peer := range this {
+        filteredPeers[id] = peer
+    }
+
+    return filteredPeers
+}
+
+var lastUpdate = time.Now()
+
+func init() {
+    updateNeighborHood()
+
+    go timeutil.Ticker(updateNeighborHood, 1 * time.Second)
+}
+
+func updateNeighborHood() {
+    if float64(len(INSTANCE)) * 1.2 <= float64(len(knownpeers.INSTANCE)) || lastUpdate.Before(time.Now().Add(-300 * time.Second)) {
+        INSTANCE = knownpeers.INSTANCE.Filter(NEIGHBORHOOD_SELECTOR, outgoingrequest.INSTANCE)
+        LIST_INSTANCE = INSTANCE.List()
+
+        lastUpdate = time.Now()
+
+        Events.Update.Trigger()
+    }
+}
diff --git a/plugins/autopeering/instances/outgoingrequest/instance.go b/plugins/autopeering/instances/outgoingrequest/instance.go
new file mode 100644
index 00000000..e4310e72
--- /dev/null
+++ b/plugins/autopeering/instances/outgoingrequest/instance.go
@@ -0,0 +1,21 @@
+package outgoingrequest
+
+import (
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/ownpeer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
+)
+
+var INSTANCE *request.Request
+
+func init() {
+    INSTANCE = &request.Request{
+        Issuer: ownpeer.INSTANCE,
+    }
+    INSTANCE.Sign()
+
+    saltmanager.Events.UpdatePublicSalt.Attach(func(salt *salt.Salt) {
+        INSTANCE.Sign()
+    })
+}
diff --git a/plugins/autopeering/instances/ownpeer/instance.go b/plugins/autopeering/instances/ownpeer/instance.go
new file mode 100644
index 00000000..7daff310
--- /dev/null
+++ b/plugins/autopeering/instances/ownpeer/instance.go
@@ -0,0 +1,17 @@
+package ownpeer
+
+import (
+    "github.com/iotaledger/goshimmer/packages/accountability"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
+    "net"
+)
+
+var INSTANCE = &peer.Peer{
+    Identity:            accountability.OWN_ID,
+    PeeringPort:         uint16(*parameters.PORT.Value),
+    GossipPort:          uint16(*parameters.PORT.Value),
+    Address:             net.IPv4(0, 0, 0, 0),
+    Salt:                saltmanager.PUBLIC_SALT,
+}
diff --git a/plugins/autopeering/parameters/parameters.go b/plugins/autopeering/parameters/parameters.go
index 8d5b29f7..092ff6f4 100644
--- a/plugins/autopeering/parameters/parameters.go
+++ b/plugins/autopeering/parameters/parameters.go
@@ -4,7 +4,6 @@ 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", "tcp://0d828930890386f036eb77982cc067c5429f7b8f@82.165.29.179:14626", "list of trusted entry nodes for auto peering")
-    TCP_PORT    = parameter.AddInt("AUTOPEERING/TCP_PORT", 14626, "tcp port for incoming peering requests")
-    UDP_PORT    = parameter.AddInt("AUTOPEERING/UDP_PORT", 14626, "udp port 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")
 )
diff --git a/plugins/autopeering/peermanager/chosen_neighbor_candidates.go b/plugins/autopeering/peermanager/chosen_neighbor_candidates.go
deleted file mode 100644
index 52f41864..00000000
--- a/plugins/autopeering/peermanager/chosen_neighbor_candidates.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package peermanager
-
-import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-)
-
-var CHOSEN_NEIGHBOR_CANDIDATES types.PeerList
-
-var CHOSEN_NEIGHBOR_DISTANCE = func(req *request.Request) func(p *peer.Peer) float64 {
-    return func(p *peer.Peer) float64 {
-        return 1
-    }
-}
-
-func init() {
-    updateNeighborCandidates()
-
-    Events.UpdateNeighborhood.Attach(updateNeighborCandidates)
-}
-
-func updateNeighborCandidates() {
-    CHOSEN_NEIGHBOR_CANDIDATES = NEIGHBORHOOD.List().Sort(CHOSEN_NEIGHBOR_DISTANCE(request.OUTGOING_REQUEST))
-}
diff --git a/plugins/autopeering/peermanager/known_peers.go b/plugins/autopeering/peermanager/known_peers.go
deleted file mode 100644
index 1b23fb82..00000000
--- a/plugins/autopeering/peermanager/known_peers.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package peermanager
-
-import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
-)
-
-var KNOWN_PEERS = initKnownPeers()
-
-func initKnownPeers() types.PeerRegister {
-    knownPeers := make(types.PeerRegister)
-    for _, entryNode := range ENTRY_NODES {
-        knownPeers.AddOrUpdate(entryNode)
-    }
-
-    return knownPeers
-}
\ No newline at end of file
diff --git a/plugins/autopeering/peermanager/neighborhood.go b/plugins/autopeering/peermanager/neighborhood.go
deleted file mode 100644
index e6d95d89..00000000
--- a/plugins/autopeering/peermanager/neighborhood.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package peermanager
-
-import (
-    "github.com/iotaledger/goshimmer/packages/timeutil"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "time"
-)
-
-var NEIGHBORHOOD types.PeerRegister
-
-var NEIGHBORHOOD_LIST types.PeerList
-
-// Selects a fixed neighborhood from all known peers - this allows nodes to "stay in the same circles" that share their
-// view on the ledger an is a preparation for economic clustering
-var NEIGHBORHOOD_SELECTOR = func(this types.PeerRegister, req *request.Request) types.PeerRegister {
-    filteredPeers := make(types.PeerRegister)
-    for id, peer := range this {
-        filteredPeers[id] = peer
-    }
-
-    return filteredPeers
-}
-
-var lastUpdate = time.Now()
-
-func init() {
-    updateNeighborHood()
-
-    go timeutil.Ticker(updateNeighborHood, 1 * time.Second)
-}
-
-func updateNeighborHood() {
-    if float64(len(NEIGHBORHOOD)) * 1.2 <= float64(len(KNOWN_PEERS)) || lastUpdate.Before(time.Now().Add(-300 * time.Second)) {
-        NEIGHBORHOOD = KNOWN_PEERS.Filter(NEIGHBORHOOD_SELECTOR, request.OUTGOING_REQUEST)
-        NEIGHBORHOOD_LIST = NEIGHBORHOOD.List()
-
-        lastUpdate = time.Now()
-
-        Events.UpdateNeighborhood.Trigger()
-    }
-}
\ No newline at end of file
diff --git a/plugins/autopeering/plugin.go b/plugins/autopeering/plugin.go
index 4f8590d6..19e4e5ae 100644
--- a/plugins/autopeering/plugin.go
+++ b/plugins/autopeering/plugin.go
@@ -3,11 +3,11 @@ package autopeering
 import (
     "github.com/iotaledger/goshimmer/packages/daemon"
     "github.com/iotaledger/goshimmer/packages/node"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "github.com/iotaledger/goshimmer/plugins/autopeering/server"
     "github.com/iotaledger/goshimmer/plugins/gossip/neighbormanager"
 )
@@ -33,7 +33,7 @@ func configure(plugin *node.Plugin) {
     })
 
     protocol.Events.DiscoverPeer.Attach(func(p *peer.Peer) {
-        if peermanager.KNOWN_PEERS.AddOrUpdate(p) {
+        if knownpeers.INSTANCE.AddOrUpdate(p) {
             plugin.LogInfo("new peer detected: " + p.Address.String() + " / " + p.Identity.StringIdentifier)
         }
     })
diff --git a/plugins/autopeering/protocol/constants/constants.go b/plugins/autopeering/protocol/constants/constants.go
index 4e26ea74..e181bf15 100644
--- a/plugins/autopeering/protocol/constants/constants.go
+++ b/plugins/autopeering/protocol/constants/constants.go
@@ -5,7 +5,14 @@ import "time"
 const (
     NEIGHBOR_COUNT = 8
 
-    FIND_NEIGHBOR_INTERVAL     = 5 * time.Second
-    PING_RANDOM_PEERS_INTERVAL = 1 * time.Second
-    PING_RANDOM_PEERS_COUNT    = 3
+    FIND_NEIGHBOR_INTERVAL = 5 * time.Second
+
+    // How often does the outgoing ping processor check if new pings should be sent.
+    PING_PROCESS_INTERVAL = 1 * time.Second
+
+    // The amount of times each neighbor should be contacted in this cycle.
+    PING_CONTACT_COUNT_PER_CYCLE = 2
+
+    // The length of a ping cycle (after this time we have sent randomized pings to all of our neighbors).
+    PING_CYCLE_LENGTH = 900 * time.Second
 )
diff --git a/plugins/autopeering/protocol/events.go b/plugins/autopeering/protocol/events.go
index 6d4d78bc..31b3c1f1 100644
--- a/plugins/autopeering/protocol/events.go
+++ b/plugins/autopeering/protocol/events.go
@@ -1,9 +1,9 @@
 package protocol
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "reflect"
 )
 
diff --git a/plugins/autopeering/protocol/incoming_ping_processor.go b/plugins/autopeering/protocol/incoming_ping_processor.go
index f2b30f9a..3f080a65 100644
--- a/plugins/autopeering/protocol/incoming_ping_processor.go
+++ b/plugins/autopeering/protocol/incoming_ping_processor.go
@@ -2,7 +2,7 @@ package protocol
 
 import (
     "github.com/iotaledger/goshimmer/packages/node"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
 )
 
 func createIncomingPingProcessor(plugin *node.Plugin) func(p *ping.Ping) {
diff --git a/plugins/autopeering/protocol/incoming_request_processor.go b/plugins/autopeering/protocol/incoming_request_processor.go
index 2f94ff19..1cba5d81 100644
--- a/plugins/autopeering/protocol/incoming_request_processor.go
+++ b/plugins/autopeering/protocol/incoming_request_processor.go
@@ -2,11 +2,12 @@ package protocol
 
 import (
     "github.com/iotaledger/goshimmer/packages/node"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighborcandidates"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/constants"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist"
     "github.com/iotaledger/goshimmer/plugins/gossip/neighbormanager"
 )
 
@@ -40,8 +41,8 @@ func createIncomingRequestProcessor(plugin *node.Plugin) func(req *request.Reque
     }
 }
 
-func proposedPeeringCandidates(req *request.Request) types.PeerList {
-    return peermanager.NEIGHBORHOOD.List().Filter(func(p *peer.Peer) bool {
+func proposedPeeringCandidates(req *request.Request) peerlist.PeerList {
+    return neighborhood.LIST_INSTANCE.Filter(func(p *peer.Peer) bool {
         return p.Identity.PublicKey != nil
-    }).Sort(peermanager.CHOSEN_NEIGHBOR_DISTANCE(req))
+    }).Sort(chosenneighborcandidates.DISTANCE(req))
 }
\ No newline at end of file
diff --git a/plugins/autopeering/protocol/incoming_response_processor.go b/plugins/autopeering/protocol/incoming_response_processor.go
index d99cf1cd..9325c655 100644
--- a/plugins/autopeering/protocol/incoming_response_processor.go
+++ b/plugins/autopeering/protocol/incoming_response_processor.go
@@ -2,7 +2,7 @@ package protocol
 
 import (
     "github.com/iotaledger/goshimmer/packages/node"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "strconv"
 )
 
diff --git a/plugins/autopeering/protocol/outgoing_ping_processor.go b/plugins/autopeering/protocol/outgoing_ping_processor.go
index 808cb1ae..151b6379 100644
--- a/plugins/autopeering/protocol/outgoing_ping_processor.go
+++ b/plugins/autopeering/protocol/outgoing_ping_processor.go
@@ -4,33 +4,35 @@ import (
     "github.com/iotaledger/goshimmer/packages/accountability"
     "github.com/iotaledger/goshimmer/packages/daemon"
     "github.com/iotaledger/goshimmer/packages/node"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood"
     "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/constants"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
     "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
     "github.com/iotaledger/goshimmer/plugins/gossip/neighbormanager"
     "math/rand"
     "net"
     "time"
 )
 
+var lastPing time.Time
+
 func createOutgoingPingProcessor(plugin *node.Plugin) func() {
     return func() {
         plugin.LogInfo("Starting Ping Processor ...")
         plugin.LogSuccess("Starting Ping Processor ... done")
+
+        lastPing = time.Now().Add(-constants.PING_CYCLE_LENGTH)
         
         outgoingPing := &ping.Ping{
             Issuer: &peer.Peer{
                 Identity:            accountability.OWN_ID,
-                PeeringProtocolType: types.PROTOCOL_TYPE_TCP,
-                PeeringPort:         uint16(*parameters.UDP_PORT.Value),
-                GossipProtocolType:  types.PROTOCOL_TYPE_TCP,
-                GossipPort:          uint16(*parameters.UDP_PORT.Value),
                 Address:             net.IPv4(0, 0, 0, 0),
+                PeeringPort:         uint16(*parameters.PORT.Value),
+                GossipPort:          uint16(*parameters.PORT.Value),
                 Salt:                saltmanager.PUBLIC_SALT,
             },
         }
@@ -42,7 +44,7 @@ func createOutgoingPingProcessor(plugin *node.Plugin) func() {
 
         pingPeers(plugin, outgoingPing)
 
-        ticker := time.NewTicker(constants.PING_RANDOM_PEERS_INTERVAL)
+        ticker := time.NewTicker(constants.PING_PROCESS_INTERVAL)
         ticker:
         for {
             select {
@@ -60,24 +62,30 @@ func createOutgoingPingProcessor(plugin *node.Plugin) func() {
 }
 
 func pingPeers(plugin *node.Plugin, outgoingPing *ping.Ping) {
-    chosenPeers := make(map[string]*peer.Peer)
+    pingDelay := constants.PING_CYCLE_LENGTH / time.Duration(len(neighborhood.LIST_INSTANCE))
 
-    for i := 0; i < constants.PING_RANDOM_PEERS_COUNT; i++ {
-        randomNeighborHoodPeer := peermanager.NEIGHBORHOOD_LIST[rand.Intn(len(peermanager.NEIGHBORHOOD_LIST))]
+    if lastPing.Add(pingDelay).Before(time.Now()) {
+        chosenPeers := make(map[string]*peer.Peer)
 
-        nodeId := randomNeighborHoodPeer.Identity.StringIdentifier
+        for i := 0; i < constants.PING_CONTACT_COUNT_PER_CYCLE; i++ {
+            randomNeighborHoodPeer := neighborhood.LIST_INSTANCE[rand.Intn(len(neighborhood.LIST_INSTANCE))]
 
-        if !neighbormanager.ACCEPTED_NEIGHBORS.Contains(nodeId) && !neighbormanager.CHOSEN_NEIGHBORS.Contains(nodeId) &&
+            nodeId := randomNeighborHoodPeer.Identity.StringIdentifier
+
+            if !neighbormanager.ACCEPTED_NEIGHBORS.Contains(nodeId) && !neighbormanager.CHOSEN_NEIGHBORS.Contains(nodeId) &&
                 nodeId != accountability.OWN_ID.StringIdentifier {
-            chosenPeers[randomNeighborHoodPeer.Identity.StringIdentifier] = randomNeighborHoodPeer
+                chosenPeers[randomNeighborHoodPeer.Identity.StringIdentifier] = randomNeighborHoodPeer
+            }
         }
-    }
 
-    for _, chosenPeer := range chosenPeers {
-        go func(chosenPeer *peer.Peer) {
-            chosenPeer.Send(outgoingPing.Marshal(), false)
+        for _, chosenPeer := range chosenPeers {
+            go func(chosenPeer *peer.Peer) {
+                chosenPeer.Send(outgoingPing.Marshal(), types.PROTOCOL_TYPE_UDP, false)
+
+                plugin.LogDebug("sent ping to " + chosenPeer.String())
+            }(chosenPeer)
+        }
 
-            plugin.LogDebug("sent ping to " + chosenPeer.String())
-        }(chosenPeer)
+        lastPing = time.Now()
     }
 }
\ No newline at end of file
diff --git a/plugins/autopeering/protocol/chosen_neighbor_processor.go b/plugins/autopeering/protocol/outgoing_request_processor.go
similarity index 63%
rename from plugins/autopeering/protocol/chosen_neighbor_processor.go
rename to plugins/autopeering/protocol/outgoing_request_processor.go
index d76a4a19..4edccbdd 100644
--- a/plugins/autopeering/protocol/chosen_neighbor_processor.go
+++ b/plugins/autopeering/protocol/outgoing_request_processor.go
@@ -4,21 +4,22 @@ import (
     "github.com/iotaledger/goshimmer/packages/accountability"
     "github.com/iotaledger/goshimmer/packages/daemon"
     "github.com/iotaledger/goshimmer/packages/node"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighborcandidates"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/outgoingrequest"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/constants"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
     "github.com/iotaledger/goshimmer/plugins/autopeering/server/tcp"
     "github.com/iotaledger/goshimmer/plugins/gossip/neighbormanager"
     "time"
 )
 
-func createChosenNeighborProcessor(plugin *node.Plugin) func() {
+func createOutgoingRequestProcessor(plugin *node.Plugin) func() {
     return func() {
         plugin.LogInfo("Starting Chosen Neighbor Processor ...")
         plugin.LogSuccess("Starting Chosen Neighbor Processor ... done")
 
-        chooseNeighbors(plugin)
+        sendOutgoingRequests(plugin)
 
         ticker := time.NewTicker(constants.FIND_NEIGHBOR_INTERVAL)
         ticker:
@@ -29,7 +30,7 @@ func createChosenNeighborProcessor(plugin *node.Plugin) func() {
 
                 break ticker
             case <- ticker.C:
-                chooseNeighbors(plugin)
+                sendOutgoingRequests(plugin)
             }
         }
 
@@ -37,8 +38,8 @@ func createChosenNeighborProcessor(plugin *node.Plugin) func() {
     }
 }
 
-func chooseNeighbors(plugin *node.Plugin) {
-    for _, chosenNeighborCandidate := range peermanager.CHOSEN_NEIGHBOR_CANDIDATES {
+func sendOutgoingRequests(plugin *node.Plugin) {
+    for _, chosenNeighborCandidate := range chosenneighborcandidates.INSTANCE {
         go func(peer *peer.Peer) {
             nodeId := peer.Identity.StringIdentifier
 
@@ -46,14 +47,14 @@ func chooseNeighbors(plugin *node.Plugin) {
                 !neighbormanager.CHOSEN_NEIGHBORS.Contains(nodeId) &&
                 accountability.OWN_ID.StringIdentifier != nodeId {
 
-                if connectionAlive, err := request.Send(peer); err != nil {
+                if dialed, err := peer.Send(outgoingrequest.INSTANCE.Marshal(), types.PROTOCOL_TYPE_TCP, true); err != nil {
                     plugin.LogDebug(err.Error())
-                } else if connectionAlive {
-                    plugin.LogDebug("sent TCP peering request to " + peer.String())
-
-                    tcp.HandleConnection(peer.Conn)
                 } else {
-                    plugin.LogDebug("sent UDP peering request to " + peer.String())
+                    plugin.LogDebug("sent peering request to " + peer.String())
+
+                    if dialed {
+                        tcp.HandleConnection(peer.Conn)
+                    }
                 }
             }
         }(chosenNeighborCandidate)
diff --git a/plugins/autopeering/protocol/plugin.go b/plugins/autopeering/protocol/plugin.go
index e7e9820a..06ae95b0 100644
--- a/plugins/autopeering/protocol/plugin.go
+++ b/plugins/autopeering/protocol/plugin.go
@@ -25,6 +25,6 @@ func Configure(plugin *node.Plugin) {
 }
 
 func Run(plugin *node.Plugin) {
-    daemon.BackgroundWorker(createChosenNeighborProcessor(plugin))
+    daemon.BackgroundWorker(createOutgoingRequestProcessor(plugin))
     daemon.BackgroundWorker(createOutgoingPingProcessor(plugin))
 }
diff --git a/plugins/autopeering/protocol/request/send.go b/plugins/autopeering/protocol/request/send.go
deleted file mode 100644
index 739eba9d..00000000
--- a/plugins/autopeering/protocol/request/send.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package request
-
-import (
-    "github.com/iotaledger/goshimmer/packages/accountability"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
-    "github.com/pkg/errors"
-    "net"
-)
-
-var OUTGOING_REQUEST *Request
-
-func Send(peer *peer.Peer) (bool, error) {
-    var keepAlive bool
-    switch peer.PeeringProtocolType {
-    case types.PROTOCOL_TYPE_TCP:
-        keepAlive = true
-    case types.PROTOCOL_TYPE_UDP:
-        keepAlive = false
-    default:
-        return false, errors.New("peer uses invalid protocol")
-    }
-
-    if err := peer.Send(OUTGOING_REQUEST.Marshal(), keepAlive); err != nil {
-        return false, err
-    }
-
-    return keepAlive, nil
-}
-
-func init() {
-    OUTGOING_REQUEST = &Request{
-        Issuer: &peer.Peer{
-            Identity:            accountability.OWN_ID,
-            PeeringProtocolType: types.PROTOCOL_TYPE_TCP,
-            PeeringPort:         uint16(*parameters.UDP_PORT.Value),
-            GossipProtocolType:  types.PROTOCOL_TYPE_TCP,
-            GossipPort:          uint16(*parameters.UDP_PORT.Value),
-            Address:             net.IPv4(0, 0, 0, 0),
-            Salt:                saltmanager.PUBLIC_SALT,
-        },
-    }
-    OUTGOING_REQUEST.Sign()
-
-    saltmanager.Events.UpdatePublicSalt.Attach(func(salt *salt.Salt) {
-        OUTGOING_REQUEST.Sign()
-    })
-}
diff --git a/plugins/autopeering/saltmanager/events.go b/plugins/autopeering/saltmanager/events.go
index 5fb00471..b9493017 100644
--- a/plugins/autopeering/saltmanager/events.go
+++ b/plugins/autopeering/saltmanager/events.go
@@ -1,7 +1,7 @@
 package saltmanager
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
     "reflect"
 )
 
diff --git a/plugins/autopeering/saltmanager/saltmanager.go b/plugins/autopeering/saltmanager/saltmanager.go
index 2c3d6239..acb88f06 100644
--- a/plugins/autopeering/saltmanager/saltmanager.go
+++ b/plugins/autopeering/saltmanager/saltmanager.go
@@ -4,7 +4,7 @@ import (
     "github.com/dgraph-io/badger"
     "github.com/iotaledger/goshimmer/packages/daemon"
     "github.com/iotaledger/goshimmer/packages/settings"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
     "time"
 )
 
diff --git a/plugins/autopeering/saltmanager/types.go b/plugins/autopeering/saltmanager/types.go
index 1a0438c0..4a273e65 100644
--- a/plugins/autopeering/saltmanager/types.go
+++ b/plugins/autopeering/saltmanager/types.go
@@ -1,5 +1,5 @@
 package saltmanager
 
-import "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+import "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
 
 type SaltConsumer = func(salt *salt.Salt)
diff --git a/plugins/autopeering/saltmanager/utils.go b/plugins/autopeering/saltmanager/utils.go
index 5142c84b..755b07db 100644
--- a/plugins/autopeering/saltmanager/utils.go
+++ b/plugins/autopeering/saltmanager/utils.go
@@ -1,7 +1,7 @@
 package saltmanager
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
     "time"
 )
 
diff --git a/plugins/autopeering/server/tcp/events.go b/plugins/autopeering/server/tcp/events.go
index dedffa4f..d1d4376f 100644
--- a/plugins/autopeering/server/tcp/events.go
+++ b/plugins/autopeering/server/tcp/events.go
@@ -1,9 +1,9 @@
 package tcp
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "net"
     "reflect"
 )
diff --git a/plugins/autopeering/server/tcp/server.go b/plugins/autopeering/server/tcp/server.go
index 81127fa8..bfe9e987 100644
--- a/plugins/autopeering/server/tcp/server.go
+++ b/plugins/autopeering/server/tcp/server.go
@@ -6,9 +6,9 @@ import (
     "github.com/iotaledger/goshimmer/packages/network/tcp"
     "github.com/iotaledger/goshimmer/packages/node"
     "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "github.com/pkg/errors"
     "math"
     "net"
@@ -24,9 +24,9 @@ func ConfigureServer(plugin *node.Plugin) {
     })
     server.Events.Start.Attach(func() {
         if *parameters.ADDRESS.Value == "0.0.0.0" {
-            plugin.LogSuccess("Starting TCP Server (port " + strconv.Itoa(*parameters.TCP_PORT.Value) + ") ... done")
+            plugin.LogSuccess("Starting TCP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ... done")
         } else {
-            plugin.LogSuccess("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.TCP_PORT.Value) + ") ... done")
+            plugin.LogSuccess("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ... done")
         }
     })
     server.Events.Shutdown.Attach(func() {
@@ -37,12 +37,12 @@ func ConfigureServer(plugin *node.Plugin) {
 func RunServer(plugin *node.Plugin) {
     daemon.BackgroundWorker(func() {
         if *parameters.ADDRESS.Value == "0.0.0.0" {
-            plugin.LogInfo("Starting TCP Server (port " + strconv.Itoa(*parameters.TCP_PORT.Value) + ") ...")
+            plugin.LogInfo("Starting TCP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ...")
         } else {
-            plugin.LogInfo("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.TCP_PORT.Value) + ") ...")
+            plugin.LogInfo("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ...")
         }
 
-        server.Listen(*parameters.TCP_PORT.Value)
+        server.Listen(*parameters.PORT.Value)
     })
 }
 
diff --git a/plugins/autopeering/server/tcp/types.go b/plugins/autopeering/server/tcp/types.go
index b8dca9d4..871d5572 100644
--- a/plugins/autopeering/server/tcp/types.go
+++ b/plugins/autopeering/server/tcp/types.go
@@ -1,9 +1,9 @@
 package tcp
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "net"
 )
 
diff --git a/plugins/autopeering/server/udp/events.go b/plugins/autopeering/server/udp/events.go
index 588e85b8..68f8d413 100644
--- a/plugins/autopeering/server/udp/events.go
+++ b/plugins/autopeering/server/udp/events.go
@@ -1,9 +1,9 @@
 package udp
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "net"
     "reflect"
 )
diff --git a/plugins/autopeering/server/udp/server.go b/plugins/autopeering/server/udp/server.go
index 46fc6e8f..704b1150 100644
--- a/plugins/autopeering/server/udp/server.go
+++ b/plugins/autopeering/server/udp/server.go
@@ -5,9 +5,9 @@ import (
     "github.com/iotaledger/goshimmer/packages/network/udp"
     "github.com/iotaledger/goshimmer/packages/node"
     "github.com/iotaledger/goshimmer/plugins/autopeering/parameters"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "github.com/pkg/errors"
     "math"
     "net"
@@ -18,7 +18,7 @@ var udpServer = udp.NewServer(int(math.Max(float64(request.MARSHALLED_TOTAL_SIZE
 
 func ConfigureServer(plugin *node.Plugin) {
     Events.Error.Attach(func(ip net.IP, err error) {
-        plugin.LogFailure("u" + err.Error())
+        plugin.LogFailure(err.Error())
     })
 
     udpServer.Events.ReceiveData.Attach(processReceivedData)
@@ -27,9 +27,9 @@ func ConfigureServer(plugin *node.Plugin) {
     })
     udpServer.Events.Start.Attach(func() {
         if *parameters.ADDRESS.Value == "0.0.0.0" {
-            plugin.LogSuccess("Starting UDP Server (port " + strconv.Itoa(*parameters.UDP_PORT.Value) + ") ... done")
+            plugin.LogSuccess("Starting UDP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ... done")
         } else {
-            plugin.LogSuccess("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.UDP_PORT.Value) + ") ... done")
+            plugin.LogSuccess("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ... done")
         }
     })
     udpServer.Events.Shutdown.Attach(func() {
@@ -40,12 +40,12 @@ func ConfigureServer(plugin *node.Plugin) {
 func RunServer(plugin *node.Plugin) {
     daemon.BackgroundWorker(func() {
         if *parameters.ADDRESS.Value == "0.0.0.0" {
-            plugin.LogInfo("Starting UDP Server (port " + strconv.Itoa(*parameters.UDP_PORT.Value) + ") ...")
+            plugin.LogInfo("Starting UDP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ...")
         } else {
-            plugin.LogInfo("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.UDP_PORT.Value) + ") ...")
+            plugin.LogInfo("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ...")
         }
 
-        udpServer.Listen(*parameters.ADDRESS.Value, *parameters.UDP_PORT.Value)
+        udpServer.Listen(*parameters.ADDRESS.Value, *parameters.PORT.Value)
     })
 }
 
diff --git a/plugins/autopeering/server/udp/types.go b/plugins/autopeering/server/udp/types.go
index c3d055d0..985e1d02 100644
--- a/plugins/autopeering/server/udp/types.go
+++ b/plugins/autopeering/server/udp/types.go
@@ -1,9 +1,9 @@
 package udp
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/ping"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
     "net"
 )
 
diff --git a/plugins/autopeering/protocol/peer/constants.go b/plugins/autopeering/types/peer/constants.go
similarity index 66%
rename from plugins/autopeering/protocol/peer/constants.go
rename to plugins/autopeering/types/peer/constants.go
index 53d53dd5..aa156709 100644
--- a/plugins/autopeering/protocol/peer/constants.go
+++ b/plugins/autopeering/types/peer/constants.go
@@ -2,34 +2,28 @@ package peer
 
 import (
     "github.com/iotaledger/goshimmer/packages/identity"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
 )
 
 const (
     MARSHALLED_PUBLIC_KEY_START            = 0
     MARSHALLED_ADDRESS_TYPE_START          = MARSHALLED_PUBLIC_KEY_END
     MARSHALLED_ADDRESS_START               = MARSHALLED_ADDRESS_TYPE_END
-    MARSHALLED_PEERING_PROTOCOL_TYPE_START = MARSHALLED_ADDRESS_END
-    MARSHALLED_PEERING_PORT_START          = MARSHALLED_PEERING_PROTOCOL_TYPE_END
-    MARSHALLED_GOSSIP_PROTOCOL_TYPE_START  = MARSHALLED_PEERING_PORT_END
-    MARSHALLED_GOSSIP_PORT_START           = MARSHALLED_GOSSIP_PROTOCOL_TYPE_END
+    MARSHALLED_PEERING_PORT_START          = MARSHALLED_ADDRESS_END
+    MARSHALLED_GOSSIP_PORT_START           = MARSHALLED_PEERING_PORT_END
     MARSHALLED_SALT_START                  = MARSHALLED_GOSSIP_PORT_END
 
     MARSHALLED_PUBLIC_KEY_END            = MARSHALLED_PUBLIC_KEY_START + MARSHALLED_PUBLIC_KEY_SIZE
     MARSHALLED_ADDRESS_TYPE_END          = MARSHALLED_ADDRESS_TYPE_START + MARSHALLED_ADDRESS_TYPE_SIZE
     MARSHALLED_ADDRESS_END               = MARSHALLED_ADDRESS_START + MARSHALLED_ADDRESS_SIZE
-    MARSHALLED_PEERING_PROTOCOL_TYPE_END = MARSHALLED_PEERING_PROTOCOL_TYPE_START + MARSHALLED_PEERING_PROTOCOL_TYPE_SIZE
     MARSHALLED_PEERING_PORT_END          = MARSHALLED_PEERING_PORT_START + MARSHALLED_PEERING_PORT_SIZE
-    MARSHALLED_GOSSIP_PROTOCOL_TYPE_END  = MARSHALLED_GOSSIP_PROTOCOL_TYPE_START + MARSHALLED_GOSSIP_PROTOCOL_TYPE_SIZE
     MARSHALLED_GOSSIP_PORT_END           = MARSHALLED_GOSSIP_PORT_START + MARSHALLED_GOSSIP_PORT_SIZE
     MARSHALLED_SALT_END                  = MARSHALLED_SALT_START + MARSHALLED_SALT_SIZE
 
     MARSHALLED_PUBLIC_KEY_SIZE            = identity.PUBLIC_KEY_BYTE_LENGTH
     MARSHALLED_ADDRESS_TYPE_SIZE          = 1
     MARSHALLED_ADDRESS_SIZE               = 16
-    MARSHALLED_PEERING_PROTOCOL_TYPE_SIZE = 1
     MARSHALLED_PEERING_PORT_SIZE          = 2
-    MARSHALLED_GOSSIP_PROTOCOL_TYPE_SIZE  = 1
     MARSHALLED_GOSSIP_PORT_SIZE           = 2
     MARSHALLED_SALT_SIZE                  = salt.SALT_MARSHALLED_SIZE
     MARSHALLED_TOTAL_SIZE                 = MARSHALLED_SALT_END
diff --git a/plugins/autopeering/protocol/peer/peer.go b/plugins/autopeering/types/peer/peer.go
similarity index 67%
rename from plugins/autopeering/protocol/peer/peer.go
rename to plugins/autopeering/types/peer/peer.go
index 8018281f..4604559a 100644
--- a/plugins/autopeering/protocol/peer/peer.go
+++ b/plugins/autopeering/types/peer/peer.go
@@ -4,7 +4,7 @@ import (
     "encoding/binary"
     "github.com/iotaledger/goshimmer/packages/identity"
     "github.com/iotaledger/goshimmer/packages/network"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/salt"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt"
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
     "github.com/pkg/errors"
     "net"
@@ -15,9 +15,7 @@ import (
 type Peer struct {
     Identity            *identity.Identity
     Address             net.IP
-    PeeringProtocolType types.ProtocolType
     PeeringPort         uint16
-    GossipProtocolType  types.ProtocolType
     GossipPort          uint16
     Salt                *salt.Salt
     Conn                *network.ManagedConnection
@@ -40,10 +38,7 @@ func Unmarshal(data []byte) (*Peer, error) {
         peer.Address = net.IP(data[MARSHALLED_ADDRESS_START:MARSHALLED_ADDRESS_END]).To16()
     }
 
-    peer.PeeringProtocolType = types.ProtocolType(data[MARSHALLED_PEERING_PROTOCOL_TYPE_START])
     peer.PeeringPort = binary.BigEndian.Uint16(data[MARSHALLED_PEERING_PORT_START:MARSHALLED_PEERING_PORT_END])
-
-    peer.GossipProtocolType = types.ProtocolType(data[MARSHALLED_GOSSIP_PROTOCOL_TYPE_START])
     peer.GossipPort = binary.BigEndian.Uint16(data[MARSHALLED_GOSSIP_PORT_START:MARSHALLED_GOSSIP_PORT_END])
 
     if unmarshalledSalt, err := salt.Unmarshal(data[MARSHALLED_SALT_START:MARSHALLED_SALT_END]); err != nil {
@@ -55,42 +50,33 @@ func Unmarshal(data []byte) (*Peer, error) {
     return peer, nil
 }
 
-func (peer *Peer) Send(data []byte, keepConnectionAlive bool) error {
-    newConnection, err := peer.Connect()
+// sends data and
+func (peer *Peer) Send(data []byte, protocol types.ProtocolType, responseExpected bool) (bool, error) {
+    conn, dialed, err := peer.Connect(protocol)
     if err != nil {
-        return err
+        return false, err
     }
 
-    if _, err := peer.Conn.Write(data); err != nil {
-        return err
+    if _, err := conn.Write(data); err != nil {
+        return false, err
     }
 
-    if newConnection && !keepConnectionAlive {
-        peer.Conn.Close()
+    if dialed && !responseExpected {
+        conn.Close()
     }
 
-    return nil
+    return dialed, nil
 }
 
-func (peer *Peer) Connect() (bool, error) {
+func (peer *Peer) ConnectTCP() (*network.ManagedConnection, bool, error) {
     if peer.Conn == nil {
         peer.connectMutex.Lock()
         defer peer.connectMutex.Unlock()
 
         if peer.Conn == nil {
-            var protocolString string
-            switch peer.PeeringProtocolType {
-            case types.PROTOCOL_TYPE_TCP:
-                protocolString = "tcp"
-            case types.PROTOCOL_TYPE_UDP:
-                protocolString = "udp"
-            default:
-                return false, errors.New("unsupported peering protocol in peer " + peer.Address.String())
-            }
-
-            conn, err := net.Dial(protocolString, peer.Address.String()+":"+strconv.Itoa(int(peer.PeeringPort)))
+            conn, err := net.Dial("tcp", peer.Address.String() + ":" + strconv.Itoa(int(peer.PeeringPort)))
             if err != nil {
-                return false, errors.New("error when connecting to " + peer.Address.String() + " during peering process: " + err.Error())
+                return nil, false, errors.New("error when connecting to " + peer.String() + ": " + err.Error())
             } else {
                 peer.Conn = network.NewManagedConnection(conn)
 
@@ -98,12 +84,32 @@ func (peer *Peer) Connect() (bool, error) {
                     peer.Conn = nil
                 })
 
-                return true, nil
+                return peer.Conn, true, nil
             }
         }
     }
 
-    return false, nil
+    return peer.Conn, false, nil
+}
+
+func (peer *Peer) ConnectUDP() (*network.ManagedConnection, bool, error) {
+    conn, err := net.Dial("udp", peer.Address.String() + ":" + strconv.Itoa(int(peer.PeeringPort)))
+    if err != nil {
+        return nil, false, errors.New("error when connecting to " + peer.Address.String() + ": " + err.Error())
+    }
+
+    return network.NewManagedConnection(conn), true, nil
+}
+
+func (peer *Peer) Connect(protocol types.ProtocolType) (*network.ManagedConnection, bool, error) {
+    switch protocol {
+    case types.PROTOCOL_TYPE_TCP:
+        return peer.ConnectTCP()
+    case types.PROTOCOL_TYPE_UDP:
+        return peer.ConnectUDP()
+    default:
+        return nil, false, errors.New("unsupported peering protocol in peer " + peer.Address.String())
+    }
 }
 
 func (peer *Peer) Marshal() []byte {
@@ -123,10 +129,7 @@ func (peer *Peer) Marshal() []byte {
 
     copy(result[MARSHALLED_ADDRESS_START:MARSHALLED_ADDRESS_END], peer.Address.To16())
 
-    result[MARSHALLED_PEERING_PROTOCOL_TYPE_START] = peer.PeeringProtocolType
     binary.BigEndian.PutUint16(result[MARSHALLED_PEERING_PORT_START:MARSHALLED_PEERING_PORT_END], peer.PeeringPort)
-
-    result[MARSHALLED_GOSSIP_PROTOCOL_TYPE_START] = peer.GossipProtocolType
     binary.BigEndian.PutUint16(result[MARSHALLED_GOSSIP_PORT_START:MARSHALLED_GOSSIP_PORT_END], peer.GossipPort)
 
     copy(result[MARSHALLED_SALT_START:MARSHALLED_SALT_END], peer.Salt.Marshal())
diff --git a/plugins/autopeering/peermanager/types/peer_list.go b/plugins/autopeering/types/peerlist/peer_list.go
similarity index 87%
rename from plugins/autopeering/peermanager/types/peer_list.go
rename to plugins/autopeering/types/peerlist/peer_list.go
index 3bcc3f86..f132e5f0 100644
--- a/plugins/autopeering/peermanager/types/peer_list.go
+++ b/plugins/autopeering/types/peerlist/peer_list.go
@@ -1,7 +1,7 @@
-package types
+package peerlist
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
     "sort"
 )
 
diff --git a/plugins/autopeering/peermanager/types/peer_register.go b/plugins/autopeering/types/peerregister/peer_register.go
similarity index 78%
rename from plugins/autopeering/peermanager/types/peer_register.go
rename to plugins/autopeering/types/peerregister/peer_register.go
index c4cbbb3f..96c27f73 100644
--- a/plugins/autopeering/peermanager/types/peer_register.go
+++ b/plugins/autopeering/types/peerregister/peer_register.go
@@ -1,10 +1,11 @@
-package types
+package peerregister
 
 import (
     "bytes"
     "github.com/iotaledger/goshimmer/packages/accountability"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/request"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist"
 )
 
 type PeerRegister map[string]*peer.Peer
@@ -44,8 +45,8 @@ func (this PeerRegister) Filter(filterFn func(this PeerRegister, req *request.Re
     return filterFn(this, req)
 }
 
-func (this PeerRegister) List() PeerList {
-    peerList := make(PeerList, len(this))
+func (this PeerRegister) List() peerlist.PeerList {
+    peerList := make(peerlist.PeerList, len(this))
 
     counter := 0
     for _, currentPeer := range this {
diff --git a/plugins/autopeering/protocol/ping/constants.go b/plugins/autopeering/types/ping/constants.go
similarity index 93%
rename from plugins/autopeering/protocol/ping/constants.go
rename to plugins/autopeering/types/ping/constants.go
index aca4a719..f43adf95 100644
--- a/plugins/autopeering/protocol/ping/constants.go
+++ b/plugins/autopeering/types/ping/constants.go
@@ -2,7 +2,7 @@ package ping
 
 import (
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/constants"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
 )
 
 const (
diff --git a/plugins/autopeering/protocol/ping/errors.go b/plugins/autopeering/types/ping/errors.go
similarity index 100%
rename from plugins/autopeering/protocol/ping/errors.go
rename to plugins/autopeering/types/ping/errors.go
diff --git a/plugins/autopeering/protocol/ping/ping.go b/plugins/autopeering/types/ping/ping.go
similarity index 92%
rename from plugins/autopeering/protocol/ping/ping.go
rename to plugins/autopeering/types/ping/ping.go
index bdd6b745..eda383ec 100644
--- a/plugins/autopeering/protocol/ping/ping.go
+++ b/plugins/autopeering/types/ping/ping.go
@@ -3,14 +3,13 @@ package ping
 import (
     "bytes"
     "github.com/iotaledger/goshimmer/packages/identity"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
     "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
 )
 
 type Ping struct {
     Issuer    *peer.Peer
-    Neighbors types.PeerList
+    Neighbors []*peer.Peer
     Signature [MARSHALLED_SIGNATURE_SIZE]byte
 }
 
diff --git a/plugins/autopeering/protocol/request/constants.go b/plugins/autopeering/types/request/constants.go
similarity index 87%
rename from plugins/autopeering/protocol/request/constants.go
rename to plugins/autopeering/types/request/constants.go
index acd24072..b0842372 100644
--- a/plugins/autopeering/protocol/request/constants.go
+++ b/plugins/autopeering/types/request/constants.go
@@ -1,7 +1,7 @@
 package request
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
 )
 
 const (
diff --git a/plugins/autopeering/protocol/request/errors.go b/plugins/autopeering/types/request/errors.go
similarity index 100%
rename from plugins/autopeering/protocol/request/errors.go
rename to plugins/autopeering/types/request/errors.go
diff --git a/plugins/autopeering/protocol/request/request.go b/plugins/autopeering/types/request/request.go
similarity index 86%
rename from plugins/autopeering/protocol/request/request.go
rename to plugins/autopeering/types/request/request.go
index 60eae5c9..79de558b 100644
--- a/plugins/autopeering/protocol/request/request.go
+++ b/plugins/autopeering/types/request/request.go
@@ -3,8 +3,10 @@ package request
 import (
     "bytes"
     "github.com/iotaledger/goshimmer/packages/identity"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/ownpeer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/response"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types"
     "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager"
     "time"
 )
@@ -48,18 +50,14 @@ func Unmarshal(data []byte) (*Request, error) {
 }
 
 func (this *Request) Accept(peers []*peer.Peer) error {
-    if _, err := this.Issuer.Connect(); err != nil {
-        return err
-    }
-
     peeringResponse := &response.Response{
         Type:   response.TYPE_ACCEPT,
-        Issuer: OUTGOING_REQUEST.Issuer,
+        Issuer: ownpeer.INSTANCE,
         Peers:  peers,
     }
     peeringResponse.Sign()
 
-    if err := this.Issuer.Send(peeringResponse.Marshal(), false); err != nil {
+    if _, err := this.Issuer.Send(peeringResponse.Marshal(), types.PROTOCOL_TYPE_TCP, false); err != nil {
         return err
     }
 
diff --git a/plugins/autopeering/protocol/response/constants.go b/plugins/autopeering/types/response/constants.go
similarity index 95%
rename from plugins/autopeering/protocol/response/constants.go
rename to plugins/autopeering/types/response/constants.go
index 250e5c98..86f65ef9 100644
--- a/plugins/autopeering/protocol/response/constants.go
+++ b/plugins/autopeering/types/response/constants.go
@@ -2,7 +2,7 @@ package response
 
 import (
     "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/constants"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
 )
 
 const (
diff --git a/plugins/autopeering/protocol/response/errors.go b/plugins/autopeering/types/response/errors.go
similarity index 100%
rename from plugins/autopeering/protocol/response/errors.go
rename to plugins/autopeering/types/response/errors.go
diff --git a/plugins/autopeering/protocol/response/response.go b/plugins/autopeering/types/response/response.go
similarity index 97%
rename from plugins/autopeering/protocol/response/response.go
rename to plugins/autopeering/types/response/response.go
index c91fc91d..d4ece51a 100644
--- a/plugins/autopeering/protocol/response/response.go
+++ b/plugins/autopeering/types/response/response.go
@@ -3,7 +3,7 @@ package response
 import (
     "bytes"
     "github.com/iotaledger/goshimmer/packages/identity"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/peer"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer"
     "github.com/pkg/errors"
 )
 
diff --git a/plugins/autopeering/protocol/response/types.go b/plugins/autopeering/types/response/types.go
similarity index 100%
rename from plugins/autopeering/protocol/response/types.go
rename to plugins/autopeering/types/response/types.go
diff --git a/plugins/autopeering/protocol/salt/constants.go b/plugins/autopeering/types/salt/constants.go
similarity index 100%
rename from plugins/autopeering/protocol/salt/constants.go
rename to plugins/autopeering/types/salt/constants.go
diff --git a/plugins/autopeering/protocol/salt/salt.go b/plugins/autopeering/types/salt/salt.go
similarity index 100%
rename from plugins/autopeering/protocol/salt/salt.go
rename to plugins/autopeering/types/salt/salt.go
diff --git a/plugins/gossip/neighbormanager/accepted_neighbors.go b/plugins/gossip/neighbormanager/accepted_neighbors.go
index 10f4ca95..46c34007 100644
--- a/plugins/gossip/neighbormanager/accepted_neighbors.go
+++ b/plugins/gossip/neighbormanager/accepted_neighbors.go
@@ -1,7 +1,7 @@
 package neighbormanager
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerregister"
 )
 
-var ACCEPTED_NEIGHBORS = make(types.PeerRegister)
+var ACCEPTED_NEIGHBORS = make(peerregister.PeerRegister)
diff --git a/plugins/gossip/neighbormanager/chosen_neighbors.go b/plugins/gossip/neighbormanager/chosen_neighbors.go
index 5e68468f..974693a5 100644
--- a/plugins/gossip/neighbormanager/chosen_neighbors.go
+++ b/plugins/gossip/neighbormanager/chosen_neighbors.go
@@ -1,7 +1,7 @@
 package neighbormanager
 
 import (
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager/types"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerregister"
 )
 
-var CHOSEN_NEIGHBORS = make(types.PeerRegister)
+var CHOSEN_NEIGHBORS = make(peerregister.PeerRegister)
diff --git a/plugins/statusscreen/ui_header_bar.go b/plugins/statusscreen/ui_header_bar.go
index 118ad837..2b4ac69c 100644
--- a/plugins/statusscreen/ui_header_bar.go
+++ b/plugins/statusscreen/ui_header_bar.go
@@ -4,7 +4,8 @@ import (
     "fmt"
     "github.com/gdamore/tcell"
     "github.com/iotaledger/goshimmer/packages/accountability"
-    "github.com/iotaledger/goshimmer/plugins/autopeering/peermanager"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers"
+    "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood"
     "github.com/iotaledger/goshimmer/plugins/gossip/neighbormanager"
     "github.com/rivo/tview"
     "math"
@@ -67,7 +68,7 @@ func (headerBar *UIHeaderBar) Update() {
     fmt.Fprintln(headerBar.InfoContainer)
     fmt.Fprintf(headerBar.InfoContainer, "[::b]Neighbors: [::d]%40v  ", strconv.Itoa(len(neighbormanager.CHOSEN_NEIGHBORS)) + " chosen / " + strconv.Itoa(len(neighbormanager.ACCEPTED_NEIGHBORS)) + " accepted")
     fmt.Fprintln(headerBar.InfoContainer)
-    fmt.Fprintf(headerBar.InfoContainer, "[::b]Known Peers: [::d]%40v  ", strconv.Itoa(len(peermanager.KNOWN_PEERS)) + " total / " + strconv.Itoa(len(peermanager.NEIGHBORHOOD)) + " neighborhood")
+    fmt.Fprintf(headerBar.InfoContainer, "[::b]Known Peers: [::d]%40v  ", strconv.Itoa(len(knownpeers.INSTANCE)) + " total / " + strconv.Itoa(len(neighborhood.INSTANCE)) + " neighborhood")
     fmt.Fprintln(headerBar.InfoContainer)
     fmt.Fprintf(headerBar.InfoContainer, "[::b]Uptime: [::d]");
 
-- 
GitLab