service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package service defines a service that routes transport protocols to stream multiplexers.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoStreamMuxers is returned when no stream muxers were specified.
	ErrNoStreamMuxers = errors.New("at least one stream muxer is required")

	// ErrNotStreamMuxer is returned when a specified service is not a stream muxer.
	ErrNotStreamMuxer = errors.New("connected service is not a stream muxer")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Routes maps protocols to stream muxer services.
	Routes map[string]string `toml:"routes" comment:"A map of protocols to stream muxers (protocol = service)."`
}

Config contains configuration options for the Stream Muxer Router service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the Stream Muxer Router service.

func (*Service) Config

func (s *Service) Config() interface{}

Config returns the current service configuration or creates one with good default values.

func (*Service) Desc

func (s *Service) Desc() string

Desc returns a description of what the service does.

func (*Service) Expose

func (s *Service) Expose() interface{}

Expose exposes the stream muxer to other services.

It exposes the type:

github.com/libp2p/go-stream-muxer.Transport

func (*Service) ID

func (s *Service) ID() string

ID returns the unique identifier of the service.

func (*Service) Name

func (s *Service) Name() string

Name returns the human friendly name of the service.

func (*Service) Needs

func (s *Service) Needs() map[string]struct{}

Needs returns the set of services this service depends on.

func (*Service) Plug

func (s *Service) Plug(exposed map[string]interface{}) error

Plug sets the connected services.

func (*Service) Run

func (s *Service) Run(ctx context.Context, running, stopping func()) error

Run starts the service.

func (*Service) SetConfig

func (s *Service) SetConfig(config interface{}) error

SetConfig configures the service.

Jump to

Keyboard shortcuts

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