2019-07-31 16:22:57 +02:00
|
|
|
// Package network is for building peer to peer networks
|
|
|
|
package network
|
|
|
|
|
|
|
|
// Network is a
|
|
|
|
type Network interface {
|
|
|
|
// Name of the network
|
|
|
|
Name() string
|
|
|
|
// Connect starts the network node
|
|
|
|
Connect() error
|
|
|
|
// Close shutsdown the network node
|
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
2019-07-31 16:35:51 +02:00
|
|
|
DefaultName = "go.micro.network"
|
|
|
|
DefaultAddress = ":0"
|
2019-07-31 16:22:57 +02:00
|
|
|
DefaultNetwork = NewNetwork()
|
|
|
|
)
|
2019-07-31 16:37:12 +02:00
|
|
|
|
|
|
|
// NewNetwork returns a new network interface
|
|
|
|
func NewNetwork(opts ...Option) Network {
|
|
|
|
return newNetwork(opts...)
|
|
|
|
}
|