Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// StaticConfig
StaticConfig
// PrivateKey is used as the private key of the peer
PrivateKey crypto.PrivKey
// Routing configures routing.Routing for the given host
Routing func(h host.Host) (routing.Routing, error)
// PubsubConfigurer enables to configure pubsub components dynamically
PubsubConfigurer PubsubConfigurer
// Opts is used to inject own options
Opts []libp2p.Option
}
Config contains both dynamic (libp2p components) and static information (json/yaml).
func (*Config) Libp2pOptions ¶
Libp2pOptions returns a list of libp2p options for the given config
func (*Config) MarshalJSON ¶ added in v0.1.4
MarshalJSON implements json.Marshaler
func (*Config) MarshalYAML ¶ added in v0.1.4
MarshalYAML implements yaml.Marshaler
func (*Config) UnmarshalJSON ¶ added in v0.1.4
UnmarshalJSON implements json.Unmarshaler
func (*Config) UnmarshalYAML ¶ added in v0.1.4
UnmarshalYAML implements yaml.Unmarshaler
type PubsubConfig ¶
type PubsubConfig struct {
// Config is the general configuration in the pubsub router level
Config *PubsubTopicConfig `json:"config" yaml:"config"`
// Topics is the configuration for topics
Topics []PubsubTopicConfig `json:"topics" yaml:"topics"`
}
func (*PubsubConfig) GetTopicCfg ¶
func (pcfg *PubsubConfig) GetTopicCfg(topicName string) []PubsubTopicConfig
GetTopicCfg returns all the relevant configs (including regex) for the given topic name
type PubsubConfigurer ¶ added in v0.1.6
type PubsubConfigurer interface {
// Topic enalbes to configure a topic, e.g. score params
Topic(topic *pubsublibp2p.Topic)
// TopicValidator returns the topic validator of this topic
TopicValidator(topicName string) (pubsublibp2p.ValidatorEx, []pubsublibp2p.ValidatorOpt)
// Opts enables to inject any set of pubsublibp2p.Option
Opts() []pubsublibp2p.Option
// TopicsOpts returns the opts for the given topic
TopicOpts(topicName string) []pubsublibp2p.TopicOpt
// SubOpts are the opts for a subscription of the given topic
SubOpts(topicName string) []pubsublibp2p.SubOpt
// PubOpts is the publish options
PubOpts(topicName string) []pubsublibp2p.PubOpt
}
PubsubConfigurer helps to aid in a custom set of configurations for pubsub
type PubsubTopicConfig ¶
type PubsubTopicConfig struct {
Name string `json:"name" yaml:"name"`
BufferSize int `json:"bufferSize,omitempty" yaml:"bufferSize,omitempty"`
SubscriptionFilter *SubscriptionFilter `json:"subscriptionFilter,omitempty" yaml:"subscriptionFilter,omitempty"`
}
type StaticConfig ¶
type StaticConfig struct {
// ListenAddrs addrs to listen, this allows to specify also the transports that are supported
ListenAddrs []string `json:"listenAddrs" yaml:"listenAddrs"`
// Relayers are possible circuit relay end-points
Relayers []string `json:"relayers,omitempty" yaml:"relayers,omitempty"`
// DialTimeout is the timeout to use when dialing peers
DialTimeout time.Duration `json:"dialTimeout,omitempty" yaml:"dialTimeout,omitempty"`
// Muxers the supported muxers
Muxers []string `json:"muxers,omitempty" yaml:"muxers,omitempty"`
// Security the supported security protocols
Security []string `json:"security,omitempty" yaml:"security,omitempty"`
// NetworkSecret is a secret to use for a private network
NetworkSecret string `json:"networkSecret,omitempty" yaml:"networkSecret,omitempty"`
// DisablePing is a negative flag to turn off libp2p Ping
DisablePing bool `json:"disablePing,omitempty" yaml:"disablePing,omitempty"`
// EnableAutoRelay whether to enable auto relay
EnableAutoRelay bool `json:"enableAutoRelay,omitempty" yaml:"enableAutoRelay,omitempty"`
// MdnsServiceTag is the service tag used by mdns service. mdns is disabled if service tag is empty
MdnsServiceTag string `json:"mdnsServiceTag,omitempty" yaml:"mdnsServiceTag,omitempty"`
// UserAgent is the user agent string used by identify protocol
UserAgent string `json:"userAgent,omitempty" yaml:"userAgent,omitempty"`
// Pubsub is the pubsub config
Pubsub *PubsubConfig `json:"pubsub,omitempty" yaml:"pubsub,omitempty"`
}
StaticConfig contains static configuration for the p2p node
type SubscriptionFilter ¶
Click to show internal directories.
Click to hide internal directories.