Documentation
¶
Overview ¶
Package mucp is for the Micro services protocol
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // NetworkChannel is the name of the tunnel channel for passing network messages NetworkChannel = "network" // ControlChannel is the name of the tunnel channel for passing control message ControlChannel = "control" // DefaultLink is default network link DefaultLink = "network" // MaxConnections is the max number of network client connections MaxConnections = 3 // MaxPeerErrors is the max number of peer errors before we remove it from network graph MaxPeerErrors = 3 )
View Source
var ( // ErrClientNotFound is returned when client for tunnel channel could not be found ErrClientNotFound = errors.New("client not found") // ErrPeerLinkNotFound is returned when peer link could not be found in tunnel Links ErrPeerLinkNotFound = errors.New("peer link not found") // ErrPeerMaxExceeded is returned when peer has reached its max error count limit ErrPeerMaxExceeded = errors.New("peer max errors exceeded") )
View Source
var ( // DefaultName is default network name DefaultName = "micro" // DefaultAddress is default network address DefaultAddress = ":0" // ResolveTime defines time interval to periodically resolve network nodes ResolveTime = 1 * time.Minute // AnnounceTime defines time interval to periodically announce node neighbours AnnounceTime = 1 * time.Second // KeepAliveTime is the time in which we want to have sent a message to a peer KeepAliveTime = 30 * time.Second // SyncTime is the time a network node requests full sync from the network SyncTime = 1 * time.Minute // PruneTime defines time interval to periodically check nodes that need to be pruned // due to their not announcing their presence within this time interval PruneTime = 90 * time.Second )
View Source
var ( // ErrPeerExists is returned when adding a peer which already exists ErrPeerExists = errors.New("peer already exists") // ErrPeerNotFound is returned when a peer could not be found in node topology ErrPeerNotFound = errors.New("peer not found") )
View Source
var ( // MaxDepth defines max depth of peer topology MaxDepth uint = 3 )
Functions ¶
func PeersToProto ¶
PeersToProto returns node peers graph encoded into protobuf
Types ¶
type Error ¶
type Error interface {
// Count is current count of errors
Count() int
// Msg is last error message
Msg() string
}
Error is network node errors
type Network ¶
type Network interface {
// Node is network node
Node
// Initialise options
Init(...Option) error
// Options returns the network options
Options() Options
// Name of the network
Name() string
// Connect starts the resolver and tunnel server
Connect() error
// Close stops the tunnel and resolving
Close() error
// Client is micro client
Client() client.Client
// Server is micro server
Server() server.Server
}
Network is micro network
func NewNetwork ¶
NewNetwork returns a new network interface
type Node ¶
type Node interface {
// Id is node id
Id() string
// Address is node bind address
Address() string
// Peers returns node peers
Peers() []Node
// Network is the network node is in
Network() Network
// Status returns node status
Status() Status
}
Node is network node
type Options ¶
type Options struct {
// Id of the node
Id string
// Name of the network
Name string
// Address to bind to
Address string
// Advertise sets the address to advertise
Advertise string
// Nodes is a list of nodes to connect to
Nodes []string
// Tunnel is network tunnel
Tunnel tunnel.Tunnel
// Router is network router
Router router.Router
// Proxy is network proxy
Proxy proxy.Proxy
// Resolver is network resolver
Resolver resolver.Resolver
}
Options configure network
Directories
¶
| Path | Synopsis |
|---|---|
|
Package broker is an interface used for asynchronous messaging
|
Package broker is an interface used for asynchronous messaging |
|
http
Package http provides a http based message broker
|
Package http provides a http based message broker |
|
memory
Package memory provides a memory broker
|
Package memory provides a memory broker |
|
nats
Package nats provides a NATS broker
|
Package nats provides a NATS broker |
|
Package client is an interface for an RPC client
|
Package client is an interface for an RPC client |
|
mucp
Package mucp provides an mucp client
|
Package mucp provides an mucp client |
|
Package codec is an interface for encoding messages
|
Package codec is an interface for encoding messages |
|
bytes
Package bytes provides a bytes codec which does not encode or decode anything
|
Package bytes provides a bytes codec which does not encode or decode anything |
|
grpc
Package grpc provides a grpc codec
|
Package grpc provides a grpc codec |
|
json
Package json provides a json codec
|
Package json provides a json codec |
|
jsonrpc
Package jsonrpc provides a json-rpc 1.0 codec
|
Package jsonrpc provides a json-rpc 1.0 codec |
|
proto
Package proto provides a proto codec
|
Package proto provides a proto codec |
|
protorpc
Protorpc provides a net/rpc proto-rpc codec.
|
Protorpc provides a net/rpc proto-rpc codec. |
|
text
Package text reads any text/* content-type
|
Package text reads any text/* content-type |
|
Package errors provides a way to return detailed information for an RPC request error.
|
Package errors provides a way to return detailed information for an RPC request error. |
|
Package log provides a log interface
|
Package log provides a log interface |
|
Package metadata is a way of defining message headers
|
Package metadata is a way of defining message headers |
|
Package proxy is a transparent proxy built on the go-micro/server
|
Package proxy is a transparent proxy built on the go-micro/server |
|
mucp
Package mucp transparently forwards the incoming request using a go-micro client.
|
Package mucp transparently forwards the incoming request using a go-micro client. |
|
Package mdns is a multicast dns registry
|
Package mdns is a multicast dns registry |
|
cache
Package cache provides a registry cache
|
Package cache provides a registry cache |
|
mdns
Package mdns provides a multicast dns registry
|
Package mdns provides a multicast dns registry |
|
memory
Package memory provides an in-memory registry
|
Package memory provides an in-memory registry |
|
Package resolver resolves network names to addresses
|
Package resolver resolves network names to addresses |
|
dns
Package dns resolves names to dns records
|
Package dns resolves names to dns records |
|
dnssrv
Package dns srv resolves names to dns srv records
|
Package dns srv resolves names to dns srv records |
|
http
Package http resolves names to network addresses using a http request
|
Package http resolves names to network addresses using a http request |
|
registry
Package registry resolves names using the go-micro registry
|
Package registry resolves names using the go-micro registry |
|
static
Package static is a static resolver
|
Package static is a static resolver |
|
Package router provides a network routing control plane
|
Package router provides a network routing control plane |
|
Package selector is a way to pick a list of service nodes
|
Package selector is a way to pick a list of service nodes |
|
dns
Package dns provides a dns SRV selector
|
Package dns provides a dns SRV selector |
|
registry
Package registry uses the go-micro registry for selection
|
Package registry uses the go-micro registry for selection |
|
router
Package router is a network/router selector
|
Package router is a network/router selector |
|
static
Package static provides a static resolver which returns the name/ip passed in without any change
|
Package static provides a static resolver which returns the name/ip passed in without any change |
|
Package server is an interface for a micro server
|
Package server is an interface for a micro server |
|
mucp
Package mucp provides an mucp server
|
Package mucp provides an mucp server |
|
Package transport is an interface for synchronous connection based communication
|
Package transport is an interface for synchronous connection based communication |
|
grpc
Package grpc provides a grpc transport
|
Package grpc provides a grpc transport |
|
http
Package http returns a http2 transport using net/http
|
Package http returns a http2 transport using net/http |
|
memory
Package memory is an in-memory transport
|
Package memory is an in-memory transport |
|
quic
Package quic provides a QUIC based transport
|
Package quic provides a QUIC based transport |
|
Package tunnel provides gre network tunnelling
|
Package tunnel provides gre network tunnelling |
|
broker
Package broker is a tunnel broker
|
Package broker is a tunnel broker |
|
transport
Package transport provides a tunnel transport
|
Package transport provides a tunnel transport |
|
util
|
|
|
backoff
Package backoff provides backoff functionality
|
Package backoff provides backoff functionality |
|
io
Package io is for io management
|
Package io is for io management |
|
jitter
Package jitter provides a random jitter
|
Package jitter provides a random jitter |
|
pki
Package pki provides PKI all the PKI functions necessary to run micro over an untrusted network including a CA
|
Package pki provides PKI all the PKI functions necessary to run micro over an untrusted network including a CA |
|
pool
Package pool is a connection pool
|
Package pool is a connection pool |
|
ring
Package ring provides a simple ring buffer for storing local data
|
Package ring provides a simple ring buffer for storing local data |
|
socket
Package socket provides a pseudo socket
|
Package socket provides a pseudo socket |
|
stream
Package stream encapsulates streams within streams
|
Package stream encapsulates streams within streams |
Click to show internal directories.
Click to hide internal directories.