move node functions

This commit is contained in:
Asim Aslam 2019-06-22 19:02:57 +01:00
parent 79cc8e34b0
commit dffbe045e4

View File

@ -10,18 +10,10 @@ type Network interface {
options.Options options.Options
// Id of this node // Id of this node
Id() string Id() string
// Address of the network
Address() string
// Connect to the network // Connect to the network
Connect() (Node, error) Connect() (Node, error)
// Peer with a neighboring network // Peer with a neighboring network
Peer(Network) (Link, error) Peer(Network) (Link, error)
// Close the network connection
Close() error
// Accept messages on the network
Accept() (*Message, error)
// Send a message to the network
Send(*Message) error
// Retrieve list of connections // Retrieve list of connections
Links() ([]Link, error) Links() ([]Link, error)
} }
@ -30,6 +22,14 @@ type Network interface {
type Node interface { type Node interface {
// Node is a network. Network is a node. // Node is a network. Network is a node.
Network Network
// Address of the node
Address() string
// Close the network connection
Close() error
// Accept messages on the network
Accept() (*Message, error)
// Send a message to the network
Send(*Message) error
} }
// Link is a connection between one network and another // Link is a connection between one network and another