From fbbc33d0f99a04e2da944a8bd0b483ef05337000 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 1 Jul 2019 22:41:27 +0100 Subject: [PATCH] Set Network() to string --- network/default.go | 6 ++---- network/network.go | 8 +++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/network/default.go b/network/default.go index 4262da8d..8fe5362b 100644 --- a/network/default.go +++ b/network/default.go @@ -189,8 +189,6 @@ func (n *network) Connect() (Node, error) { node.transport = transport.DefaultTransport } - // start the node - // we listen on a random address, this is not advertised // TODO: use util/addr to get something anyone in the same private network can talk to l, err := node.transport.Listen(":0") @@ -479,8 +477,8 @@ func (n *node) Links() ([]Link, error) { return links, nil } -func (n *node) Network() Network { - return n.network +func (n *node) Network() string { + return n.network.id } func (n *node) Send(m *Message) error { diff --git a/network/network.go b/network/network.go index dfa0116b..f8b74391 100644 --- a/network/network.go +++ b/network/network.go @@ -10,10 +10,12 @@ import ( "github.com/micro/go-micro/network/router" ) -// Network defines a network interface +// Network defines a network interface. The network is a single +// shared network between all nodes connected to it. The network +// is responsible for routing messages to the correct services. type Network interface { options.Options - // Id of this node + // Id of the network Id() string // Connect to the network Connect() (Node, error) @@ -30,7 +32,7 @@ type Node interface { // Address of the node Address() string // The network of the node - Network() Network + Network() string // Links to other nodes Links() ([]Link, error) // Close the network connection