Skip to content
Snippets Groups Projects
Commit f8b7c93a authored by capossele's avatar capossele
Browse files

:construction: WIP

parent 289f3bd3
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ require (
github.com/go-zeromq/zmq4 v0.6.2
github.com/google/open-location-code/go v0.0.0-20190903173953-119bc96a3a51
github.com/gorilla/websocket v1.4.1
github.com/iotaledger/autopeering-sim v0.0.0-20191202124431-1705dc628175
github.com/iotaledger/autopeering-sim v0.0.0-20191202212322-a6353b992662
github.com/iotaledger/hive.go v0.0.0-20191202111738-357cee7a1c37
github.com/iotaledger/iota.go v1.0.0-beta.10
github.com/labstack/echo v3.3.10+incompatible
......@@ -31,7 +31,7 @@ require (
golang.org/x/net v0.0.0-20191126235420-ef20fe5d7933
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 // indirect
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d // indirect
golang.org/x/tools v0.0.0-20191202203127-2b6af5f9ace7 // indirect
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect
gopkg.in/yaml.v2 v2.2.7 // indirect
)
......@@ -95,6 +95,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/iotaledger/autopeering-sim v0.0.0-20191202124431-1705dc628175 h1:/RAxj+VEPTykp9cWRKTtydkfuBDaFemI7/bdNYCD7Nw=
github.com/iotaledger/autopeering-sim v0.0.0-20191202124431-1705dc628175/go.mod h1:JiaqaxLkQVnd8e/sya9y/LlRW56WlRKRl2TQXQCVssI=
github.com/iotaledger/autopeering-sim v0.0.0-20191202212322-a6353b992662 h1:al3bYvSaJnFyupe7bqgXYeBZ7W0fTNWrFd9WLLNlC6I=
github.com/iotaledger/autopeering-sim v0.0.0-20191202212322-a6353b992662/go.mod h1:JiaqaxLkQVnd8e/sya9y/LlRW56WlRKRl2TQXQCVssI=
github.com/iotaledger/goshimmer v0.0.0-20191113134331-c2d1b2f9d533/go.mod h1:7vYiofXphp9+PkgVAEM0pvw3aoi4ksrZ7lrEgX50XHs=
github.com/iotaledger/hive.go v0.0.0-20191118130432-89eebe8fe8eb h1:nuS/LETRJ8obUyBIZeyxeei0ZPlyOMj8YPziOgSM4Og=
github.com/iotaledger/hive.go v0.0.0-20191118130432-89eebe8fe8eb/go.mod h1:1Thhlil4lHzuy53EVvmEbEvWBFY0Tasp4kCBfxBCPIk=
......@@ -322,6 +324,8 @@ golang.org/x/tools v0.0.0-20191121040551-947d4aa89328/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d h1:/iIZNFGxc/a7C3yWjGcnboV+Tkc7mxr+p6fDztwoxuM=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191202203127-2b6af5f9ace7 h1:I7bfRTrfnb7yQSesz6OhwGVh2imeNUcbbS8YtFYC8Ck=
golang.org/x/tools v0.0.0-20191202203127-2b6af5f9ace7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
......
......@@ -103,24 +103,29 @@ func start() {
}
// add a service for the gossip
local.INSTANCE.UpdateService(service.GossipKey, &networkAddress{"tcp", gossipAddr})
log.Debug("Local Services:", local.INSTANCE.Services().CreateRecord().String())
if parameter.NodeConfig.GetBool(CFG_SELECTION) {
local.INSTANCE.UpdateService(service.GossipKey, "tcp", gossipAddr)
}
Discovery = discover.New(local.INSTANCE, discover.Config{
Log: logger.Named("disc"),
MasterPeers: masterPeers,
})
//if parameter.NodeConfig.GetBool(CFG_SELECTION) {
Selection = selection.New(local.INSTANCE, Discovery, selection.Config{
Log: logger.Named("sel"),
Param: &selection.Parameters{
SaltLifetime: selection.DefaultSaltLifetime,
// RequiredService: []string{"gossip"},
},
})
handlers := append([]server.Handler{}, Discovery)
if parameter.NodeConfig.GetBool(CFG_SELECTION) {
Selection = selection.New(local.INSTANCE, Discovery, selection.Config{
Log: logger.Named("sel"),
Param: &selection.Parameters{
SaltLifetime: selection.DefaultSaltLifetime,
// RequiredService: []string{"gossip"},
},
})
handlers = append(handlers, Selection)
}
// start a server doing discovery and peering
srv = server.Listen(local.INSTANCE, trans, logger.Named("srv"), Discovery, Selection)
srv = server.Listen(local.INSTANCE, trans, logger.Named("srv"), handlers...)
defer srv.Close()
// start the discovery on that connection
......@@ -176,18 +181,3 @@ func printReport(log *zap.SugaredLogger) {
log.Info("Chosen:", len(outgoing))
log.Info("Accepted:", len(incoming))
}
type networkAddress struct {
network string
address string
}
// Network returns the service's network name.
func (a *networkAddress) Network() string {
return a.network
}
// String returns the service's address in string form.
func (a *networkAddress) String() string {
return a.address
}
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