Documentation ¶
Index ¶
- Variables
- type Agent
- func (a *Agent) AddService(serv *Service) (*pb.ULID, error)
- func (a *Agent) Connect(labels *pb.LabelSet) (net.Conn, error)
- func (a *Agent) Nego(ctx context.Context, L hclog.Logger, conn net.Conn, hubCfg discovery.HubConfig, ...) error
- func (a *Agent) RPCClient() (*wire.RPCClient, error)
- func (a *Agent) Run(ctx context.Context, hcp discovery.HubConfigProvider) error
- func (a *Agent) Start(ctx context.Context, hcp discovery.HubConfigProvider) error
- func (a *Agent) Wait(ctx context.Context) error
- type Conn
- type Label
- type Service
- type ServiceContext
- type ServiceHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrReadHijacked = errors.New("read hijacked, structured access not available") ErrWriteHijacked = errors.New("write hijacked, structured access not available") )
View Source
var ErrProtocolError = errors.New("protocol error detected")
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { L hclog.Logger LocalAddr string Token string Labels []string // RootCAs are the RootCAs to trust for connections to the hubs. If this // is not set, the defaults are used. RootCAs *x509.CertPool // contains filtered or unexported fields }
type Conn ¶
type Conn struct { io.Reader io.WriteCloser Stream *yamux.Stream Labels *pb.LabelSet // contains filtered or unexported fields }
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote network address.
type Service ¶
type Service struct { // The identifier for the service, populated when the service is added. Id *pb.ULID // The type identifer for the service. These identifiers are used by other // agents and hubs to find services of a particular type. Type string // The unique identifiers for the service. The labels can be anything and are // used by agents and hubs to locate services. Labels *pb.LabelSet // An additional metadata to attach to the service. Peer agents will be able to // see this metadata. Metadata map[string]string // The handler to invoke when the service is called. Handler ServiceHandler }
Describes a service that an agent is advertising. When a client connects to the service, the Handler will be invoked.
type ServiceContext ¶
type ServiceHandler ¶
type ServiceHandler interface {
HandleRequest(ctx context.Context, L hclog.Logger, sctx ServiceContext) error
}
The implementation of a service. req is the request sent initially. fr and fw are used to read and write data from the client.
func EchoHandler ¶
func EchoHandler() ServiceHandler
func HTTPHandler ¶
func HTTPHandler(url string) ServiceHandler
func TCPHandler ¶
func TCPHandler(addr string) ServiceHandler
Click to show internal directories.
Click to hide internal directories.