Set Network() to string

This commit is contained in:
Asim Aslam 2019-07-01 22:41:27 +01:00
parent da299ea26b
commit fbbc33d0f9
2 changed files with 7 additions and 7 deletions

View File

@ -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 {

View File

@ -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