relay

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2019 License: GPL-3.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *Config, brk breaker.Breaker, agent units.Agent) *relay

Types

type Config

type Config struct {
	Port     int
	Address  string
	Managers []string
	Timeout  time.Duration
}

Port is the listening port (for example: 8080), Address is the ip:port of the machine (for example: 10.1.0.1:8080).

Manager is the ip:port list of the management cluster.

Timeout is the read/write timeout period of the Relay.

type Message

type Message struct {
	M  *protocol.Message
	Ch chan *protocol.Message
}

type Relay

type Relay interface {
	Run()
	Stop()

	Exit(string) error
	Join(string, int, time.Duration) (<-chan *Message, error) // The third parameter is the timeout for waiting for a reply.

	Channel() chan<- *Message // If you set Ch, you will get a reply.
}

Relay is used to handle all message sending and receiving

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL