Set Network() to string
This commit is contained in:
parent
da299ea26b
commit
fbbc33d0f9
@ -189,8 +189,6 @@ func (n *network) Connect() (Node, error) {
|
|||||||
node.transport = transport.DefaultTransport
|
node.transport = transport.DefaultTransport
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the node
|
|
||||||
|
|
||||||
// we listen on a random address, this is not advertised
|
// 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
|
// TODO: use util/addr to get something anyone in the same private network can talk to
|
||||||
l, err := node.transport.Listen(":0")
|
l, err := node.transport.Listen(":0")
|
||||||
@ -479,8 +477,8 @@ func (n *node) Links() ([]Link, error) {
|
|||||||
return links, nil
|
return links, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) Network() Network {
|
func (n *node) Network() string {
|
||||||
return n.network
|
return n.network.id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *node) Send(m *Message) error {
|
func (n *node) Send(m *Message) error {
|
||||||
|
@ -10,10 +10,12 @@ import (
|
|||||||
"github.com/micro/go-micro/network/router"
|
"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 {
|
type Network interface {
|
||||||
options.Options
|
options.Options
|
||||||
// Id of this node
|
// Id of the network
|
||||||
Id() string
|
Id() string
|
||||||
// Connect to the network
|
// Connect to the network
|
||||||
Connect() (Node, error)
|
Connect() (Node, error)
|
||||||
@ -30,7 +32,7 @@ type Node interface {
|
|||||||
// Address of the node
|
// Address of the node
|
||||||
Address() string
|
Address() string
|
||||||
// The network of the node
|
// The network of the node
|
||||||
Network() Network
|
Network() string
|
||||||
// Links to other nodes
|
// Links to other nodes
|
||||||
Links() ([]Link, error)
|
Links() ([]Link, error)
|
||||||
// Close the network connection
|
// Close the network connection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user