Documentation ¶
Index ¶
- func DiscoveryService(s ...ServiceDiscovery) func(cfg *Config) error
- func ExchangeKeys(s string) func(cfg *Config) error
- func FromBase64(enablemDNS, enableDHT bool, bb string, d ...dht.Option) func(cfg *Config) error
- func FromYaml(enablemDNS, enableDHT bool, path string, d ...dht.Option) func(cfg *Config) error
- func Handlers(h ...Handler) func(cfg *Config) error
- func Insecure(b bool) func(cfg *Config) error
- func LibP2PLogLevel(l log.LogLevel) func(cfg *Config) error
- func ListenAddresses(ss ...string) func(cfg *Config) error
- func Logger(l log.StandardLogger) func(cfg *Config) error
- func MaxMessageSize(i int) func(cfg *Config) error
- func NetSetLimit(mgr network.ResourceManager, scope string, limit NetLimitConfig) error
- func RoomName(s string) func(cfg *Config) error
- func SealKeyInterval(i int) func(cfg *Config) error
- func SealKeyLength(i int) func(cfg *Config) error
- func WithBlacklist(i ...string) func(cfg *Config) error
- func WithDiscoveryBootstrapPeers(a discovery.AddrList) func(cfg *Config) error
- func WithDiscoveryInterval(t time.Duration) func(cfg *Config) error
- func WithInterfaceAddress(i string) func(cfg *Config) error
- func WithLedgerAnnounceTime(t time.Duration) func(cfg *Config) error
- func WithLedgerInterval(t time.Duration) func(cfg *Config) error
- func WithLibp2pAdditionalOptions(i ...libp2p.Option) func(cfg *Config) error
- func WithLibp2pOptions(i ...libp2p.Option) func(cfg *Config) error
- func WithNetworkService(ns ...NetworkService) func(cfg *Config) error
- func WithStore(s blockchain.Store) func(cfg *Config) error
- func WithStreamHandler(id protocol.Protocol, h StreamHandler) func(cfg *Config) error
- type Config
- type Gater
- type Handler
- type NetLimitConfig
- type NetworkService
- type Node
- type OTP
- type OTPConfig
- type Option
- type Sealer
- type ServiceDiscovery
- type StreamHandler
- type YAMLConnectionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoveryService ¶
func DiscoveryService(s ...ServiceDiscovery) func(cfg *Config) error
DiscoveryService Adds the service given as argument to the discovery services
func ExchangeKeys ¶
func FromBase64 ¶
func LibP2PLogLevel ¶
func ListenAddresses ¶
func MaxMessageSize ¶
func NetSetLimit ¶ added in v0.11.0
func NetSetLimit(mgr network.ResourceManager, scope string, limit NetLimitConfig) error
func SealKeyInterval ¶
func SealKeyLength ¶
func WithBlacklist ¶ added in v0.8.4
func WithInterfaceAddress ¶
func WithLibp2pOptions ¶
WithLibp2pOptions Overrides defaults options
func WithNetworkService ¶
func WithNetworkService(ns ...NetworkService) func(cfg *Config) error
func WithStreamHandler ¶
func WithStreamHandler(id protocol.Protocol, h StreamHandler) func(cfg *Config) error
WithStreamHandler adds a handler to the list that is called on each received message
Types ¶
type Config ¶
type Config struct { // ExchangeKey is a Symmetric key used to seal the messages ExchangeKey string // RoomName is the OTP token gossip room where all peers are subscribed to RoomName string // ListenAddresses is the discovery peer initial bootstrap addresses ListenAddresses []discovery.AddrList // Insecure disables secure p2p e2e encrypted communication Insecure bool // Handlers are a list of handlers subscribed to messages received by the vpn interface Handlers []Handler MaxMessageSize int SealKeyInterval int ServiceDiscovery []ServiceDiscovery NetworkServices []NetworkService Logger log.StandardLogger SealKeyLength int InterfaceAddress string Store blockchain.Store // Handle is a handle consumed by HumanInterfaces to handle received messages Handle func(bool, *hub.Message) StreamHandlers map[protocol.Protocol]StreamHandler AdditionalOptions, Options []libp2p.Option DiscoveryInterval, LedgerSyncronizationTime, LedgerAnnounceTime time.Duration DiscoveryBootstrapPeers discovery.AddrList Whitelist, Blacklist []string Sealer Sealer PeerGater Gater }
Config is the node configuration
type NetLimitConfig ¶ added in v0.11.0
type NetLimitConfig struct { Dynamic bool `json:",omitempty"` // set if Dynamic is false Memory int64 `json:",omitempty"` // set if Dynamic is true MemoryFraction float64 `json:",omitempty"` MinMemory int64 `json:",omitempty"` MaxMemory int64 `json:",omitempty"` Streams, StreamsInbound, StreamsOutbound int Conns, ConnsInbound, ConnsOutbound int FD int }
type NetworkService ¶
NetworkService is a service running over the network. It takes a context, a node and a ledger
type Node ¶
type Node struct { MessageHub *hub.MessageHub sync.Mutex // contains filtered or unexported fields }
func (*Node) BlockSubnet ¶ added in v0.8.4
BlockSubnet blocks the CIDR subnet from connections
func (*Node) ConnectionGater ¶ added in v0.8.4
func (e *Node) ConnectionGater() *conngater.BasicConnectionGater
ConnectionGater returns the underlying libp2p conngater
type ServiceDiscovery ¶
type StreamHandler ¶ added in v0.7.2
type StreamHandler func(*Node, *blockchain.Ledger) func(stream network.Stream)
type YAMLConnectionConfig ¶
type YAMLConnectionConfig struct { OTP OTP `yaml:"otp"` RoomName string `yaml:"room"` Rendezvous string `yaml:"rendezvous"` MDNS string `yaml:"mdns"` MaxMessageSize int `yaml:"max_message_size"` }
func GenerateNewConnectionData ¶
func GenerateNewConnectionData(i ...int) *YAMLConnectionConfig
func (YAMLConnectionConfig) Base64 ¶
func (y YAMLConnectionConfig) Base64() string
Base64 returns the base64 string representation of the connection
func (YAMLConnectionConfig) YAML ¶
func (y YAMLConnectionConfig) YAML() string
YAML returns the connection config as yaml string
Click to show internal directories.
Click to hide internal directories.