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) func(cfg *Config) error
- func FromYaml(enablemDNS, enableDHT bool, path string) 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 RoomName(s string) func(cfg *Config) error
- func SealKeyInterval(i int) func(cfg *Config) error
- func SealKeyLength(i int) 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.ID, h types.StreamHandler) func(cfg *Config) error
- type Config
- type Handler
- type NetworkService
- type Node
- type OTP
- type OTPConfig
- type Option
- type ServiceDiscovery
- 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 LibP2PLogLevel ¶
func ListenAddresses ¶
func MaxMessageSize ¶
func SealKeyInterval ¶
func SealKeyLength ¶
func WithInterfaceAddress ¶
func WithLibp2pOptions ¶
WithLibp2pOptions Overrides defaults options
func WithNetworkService ¶
func WithNetworkService(ns ...NetworkService) func(cfg *Config) error
func WithStreamHandler ¶
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 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[p2pprotocol.ID]types.StreamHandler AdditionalOptions, Options []libp2p.Option DiscoveryInterval, LedgerSyncronizationTime, LedgerAnnounceTime time.Duration DiscoveryBootstrapPeers discovery.AddrList }
Config is the node configuration
type NetworkService ¶
NetworkService is a service running over the network. It takes a context, a node and a ledger
type Node ¶
func (*Node) AddNetworkService ¶
func (e *Node) AddNetworkService(n NetworkService)
AddNetworkService register a network service to the node. Note: must be called before Start().
func (*Node) AddStreamHandler ¶
func (e *Node) AddStreamHandler(id protocol.Protocol, s types.StreamHandler)
AddStreamHandler adds a stream handler for the given protocol. Note: must be called before Start().
type ServiceDiscovery ¶
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() *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.