config

package
v0.0.0-...-cdbe267 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FlagChain1RegistryAddress represents the registry address for chain1.
	FlagChain1RegistryAddress = getRegistryFlag(1)
	// FlagChain2RegistryAddress represents the registry address for chain2.
	FlagChain2RegistryAddress = getRegistryFlag(2)
	// FlagChain1HermesAddress represents the hermes address for chain1.
	FlagChain1HermesAddress = getHermesIDFlag(1)
	// FlagChain2HermesAddress represents the hermes address for chain2.
	FlagChain2HermesAddress = getHermesIDFlag(2)
	// FlagChain1ChannelImplementationAddress represents the channel implementation address for chain1.
	FlagChain1ChannelImplementationAddress = getChannelImplementationFlag(1)
	// FlagChain2ChannelImplementationAddress represents the channel implementation address for chain2.
	FlagChain2ChannelImplementationAddress = getChannelImplementationFlag(2)
	// FlagChain1MystAddress represents the myst address for chain1.
	FlagChain1MystAddress = getMystAddressFlag(1)
	// FlagChain2MystAddress represents the myst address for chain2.
	FlagChain2MystAddress = getMystAddressFlag(2)
	// FlagChain1ChainID represents the chainID for chain1.
	FlagChain1ChainID = getChainIDFlag(1)
	// FlagChain1ChainID represents the chainID for chain2.
	FlagChain2ChainID = getChainIDFlag(2)
	// FlagChain1KnownHermeses represents the known hermeses for chain1.
	FlagChain1KnownHermeses = getKnownHermesesFlag(1)
	// FlagChain2KnownHermeses represents the known hermeses for chain2.
	FlagChain2KnownHermeses = getKnownHermesesFlag(2)
)

TODO: open to suggestions how to do this better.

View Source
var (
	// FlagConfigDir directory containing all configuration files.
	FlagConfigDir = cli.StringFlag{
		Name:  "config-dir",
		Usage: "Config directory containing all configuration files",
	}
	// FlagDataDir data directory for keystore and other persistent files.
	FlagDataDir = cli.StringFlag{
		Name:  "data-dir",
		Usage: "Data directory containing keystore & other persistent files",
	}
	// FlagNodeUIDir directory containing downloaded nodeUI releases
	FlagNodeUIDir = cli.StringFlag{
		Name:  "node-ui-dir",
		Usage: "Directory containing downloaded nodeUI releases",
	}
	// FlagLogDir is a directory for storing log files.
	FlagLogDir = cli.StringFlag{
		Name:  "log-dir",
		Usage: "Log directory for storing log files. data-dir/logs is used if not specified.",
	}
	// FlagRuntimeDir runtime writable directory for temporary files.
	FlagRuntimeDir = cli.StringFlag{
		Name:  "runtime-dir",
		Usage: "Runtime writable directory for temp files",
	}
	// FlagScriptDir directory containing script and helper files.
	FlagScriptDir = cli.StringFlag{
		Name:  "script-dir",
		Usage: "Script directory containing all script and helper files",
	}
)
View Source
var (
	// FlagIPDetectorURL URL of IP detection service.
	FlagIPDetectorURL = cli.StringFlag{
		Name:  "ip-detector",
		Usage: "Address (URL form) of IP detection service",
		Value: metadata.DefaultNetwork.LocationAddress,
	}
	// FlagLocationType location detector type.
	FlagLocationType = cli.StringFlag{
		Name:  "location.type",
		Usage: "Location autodetect adapter. Options: { oracle, builtin, mmdb, manual }",
		Value: "oracle",
	}
	// FlagLocationAddress URL of location detector.
	FlagLocationAddress = cli.StringFlag{
		Name: metadata.FlagNames.LocationAddress,
		Usage: fmt.Sprintf(
			"Address of specific location adapter given in '--%s'",
			FlagLocationType.Name,
		),
		Value: metadata.DefaultNetwork.LocationAddress,
	}
	// FlagLocationCountry service location country.
	FlagLocationCountry = cli.StringFlag{
		Name:  "location.country",
		Usage: "Service location country",
	}
	// FlagLocationCity service location city.
	FlagLocationCity = cli.StringFlag{
		Name:  "location.city",
		Usage: "Service location city",
	}
	// FlagLocationIPType service location node type.
	FlagLocationIPType = cli.StringFlag{
		Name:  "location.ip-type",
		Usage: "Service location IP type (residential, datacenter, etc.)",
	}
)
View Source
var (
	// FlagMMNAddress URL Of my.mysterium.network API.
	FlagMMNAddress = cli.StringFlag{
		Name:  metadata.FlagNames.MMNAddress,
		Usage: "URL of MMN WEB",
		Value: metadata.DefaultNetwork.MMNAddress,
	}
	// FlagMMNAPIAddress URL Of my.mysterium.network API.
	FlagMMNAPIAddress = cli.StringFlag{
		Name:  metadata.FlagNames.MMNAPIAddress,
		Usage: "URL of MMN API",
		Value: metadata.DefaultNetwork.MMNAPIAddress,
	}
	// FlagMMNAPIKey token Of my.mysterium.network API.
	FlagMMNAPIKey = cli.StringFlag{
		Name:  "mmn.api-key",
		Usage: "Token of MMN API",
		Value: "",
	}
)
View Source
var (
	// FlagBlockchainNetwork uses specified blockchain network.
	FlagBlockchainNetwork = cli.StringFlag{
		Name:  "network",
		Usage: "Defines default blockchain network configuration",
		Value: string(Mainnet),
	}
	// FlagAPIAddress Mysterium API URL
	// Deprecated: use FlagDiscoveryAddress
	FlagAPIAddress = cli.StringFlag{
		Name:  metadata.FlagNames.MysteriumAPIAddress,
		Usage: "Deprecated flag. Use `discovery.address` flag instead to specify URL of Discovery API",
		Value: metadata.DefaultNetwork.MysteriumAPIAddress,
	}
	// FlagDiscoveryAddress discovery url
	FlagDiscoveryAddress = cli.StringFlag{
		Name:  metadata.FlagNames.DiscoveryAddress,
		Usage: "URL of Discovery API",
		Value: metadata.DefaultNetwork.DiscoveryAddress,
	}
	// FlagChainID chain id to use
	FlagChainID = cli.Int64Flag{
		Name:  metadata.FlagNames.DefaultChainIDFlag,
		Usage: "The chain ID to use",
		Value: metadata.DefaultNetwork.DefaultChainID,
	}
	// FlagBrokerAddress message broker URI.
	FlagBrokerAddress = cli.StringSliceFlag{
		Name:  metadata.FlagNames.BrokerAddressesFlag,
		Usage: "URI of message broker",
		Value: cli.NewStringSlice(metadata.DefaultNetwork.BrokerAddresses...),
	}
	// FlagEtherRPCL1 URL or IPC socket to connect to Ethereum node.
	FlagEtherRPCL1 = cli.StringSliceFlag{
		Name:  metadata.FlagNames.Chain1Flag.EtherClientRPCFlag,
		Usage: "L1 URL or IPC socket to connect to ethereum node, anything what ethereum client accepts - works",
		Value: cli.NewStringSlice(metadata.DefaultNetwork.Chain1.EtherClientRPC...),
	}
	// FlagEtherRPCL2 URL or IPC socket to connect to Ethereum node.
	FlagEtherRPCL2 = cli.StringSliceFlag{
		Name:  metadata.FlagNames.Chain2Flag.EtherClientRPCFlag,
		Usage: "L2 URL or IPC socket to connect to ethereum node, anything what ethereum client accepts - works",
		Value: cli.NewStringSlice(metadata.DefaultNetwork.Chain2.EtherClientRPC...),
	}
	// FlagNATHolePunching remove the deprecated flag once all users stop to call it.
	FlagNATHolePunching = cli.BoolFlag{
		Name:    "nat-hole-punching",
		Aliases: []string{"experiment-natpunching"},
		Usage:   "Deprecated flag use `traversal` flag instead to disable or enable methods",
		Value:   true,
	}
	// FlagPortMapping enables NAT port mapping.
	FlagPortMapping = cli.BoolFlag{
		Name:  "nat-port-mapping",
		Usage: "Deprecated flag use `traversal` flag instead to disable or enable methods",
		Value: true,
	}
	// FlagIncomingFirewall enables incoming traffic filtering.
	FlagIncomingFirewall = cli.BoolFlag{
		Name:  "incoming-firewall",
		Usage: "Enables incoming traffic filtering",
		Value: false,
	}
	// FlagOutgoingFirewall enables outgoing traffic filtering.
	FlagOutgoingFirewall = cli.BoolFlag{
		Name:  "outgoing-firewall",
		Usage: "Enables outgoing traffic filtering",
		Value: false,
	}
	// FlagKeepConnectedOnFail keeps connection active to prevent traffic leaks.
	FlagKeepConnectedOnFail = cli.BoolFlag{
		Name:  "keep-connected-on-fail",
		Usage: "Do not disconnect consumer on session fail to prevent traffic leaks",
		Value: false,
	}
	// FlagAutoReconnect restore connection automatically once it failed.
	FlagAutoReconnect = cli.BoolFlag{
		Name:  "auto-reconnect",
		Usage: "Restore connection automatically once it failed",
		Value: false,
	}
	// FlagSTUNservers list of STUN server to be used to detect NAT type.
	FlagSTUNservers = cli.StringSliceFlag{
		Name:  "stun-servers",
		Usage: "Comma separated list of STUN server to be used to detect NAT type",
		Value: cli.NewStringSlice("stun.l.google.com:19302", "stun1.l.google.com:19302", "stun2.l.google.com:19302"),
	}
	// FlagLocalServiceDiscovery enables SSDP and Bonjour local service discovery.
	FlagLocalServiceDiscovery = cli.BoolFlag{
		Name:  "local-service-discovery",
		Usage: "Enables SSDP and Bonjour local service discovery",
		Value: true,
	}
	// FlagUDPListenPorts sets allowed UDP port range for listening.
	FlagUDPListenPorts = cli.StringFlag{
		Name:  "udp.ports",
		Usage: "Range of UDP listen ports used for connections",
		Value: "10000:60000",
	}
	// FlagTraversal order of NAT traversal methods to be used for providing service.
	FlagTraversal = cli.StringFlag{
		Name:  "traversal",
		Usage: "Comma separated order of NAT traversal methods to be used for providing service",
		Value: "manual,upnp,holepunching",
	}
	// FlagPortCheckServers list of asymmetric UDP echo servers for checking port availability
	FlagPortCheckServers = cli.StringFlag{
		Name:   "port-check-servers",
		Usage:  "Comma separated list of asymmetric UDP echo servers for checking port availability",
		Value:  "echo.mysterium.network:4589",
		Hidden: true,
	}

	// FlagStatsReportInterval is interval for consumer connection statistics reporting.
	FlagStatsReportInterval = cli.DurationFlag{
		Name:   "stats-report-interval",
		Usage:  "Duration between syncing stats from the network interface with a node",
		Value:  1 * time.Second,
		Hidden: true,
	}

	// FlagDNSListenPort sets the port for listening by DNS service.
	FlagDNSListenPort = cli.IntFlag{
		Name:  "dns.listen-port",
		Usage: "DNS listen port for services",
		Value: 11253,
	}
)
View Source
var (

	// FlagDiscoveryType proposal discovery adapter.
	FlagDiscoveryType = cli.StringSliceFlag{
		Name:  "discovery.type",
		Usage: `Proposal discovery adapter(s) separated by comma. Options: { "api", "broker", "api,broker,dht" }`,
		Value: cli.NewStringSlice("api"),
	}
	// FlagDiscoveryPingInterval proposal ping interval in seconds.
	FlagDiscoveryPingInterval = cli.DurationFlag{
		Name:  "discovery.ping",
		Usage: `Proposal update interval { "30s", "3m", "1h20m30s" }`,
		Value: 180 * time.Second,
	}
	// FlagDiscoveryFetchInterval proposal fetch interval in seconds.
	FlagDiscoveryFetchInterval = cli.DurationFlag{
		Name:  "discovery.fetch",
		Usage: `Proposal fetch interval { "30s", "3m", "1h20m30s" }`,
		Value: 180 * time.Second,
	}
	// FlagDHTAddress IP address of interface to listen for DHT connections.
	FlagDHTAddress = cli.StringFlag{
		Name:  "discovery.dht.address",
		Usage: "IP address to bind DHT to",
		Value: "0.0.0.0",
	}
	// FlagDHTPort listens DHT connections on the specified port.
	FlagDHTPort = cli.IntFlag{
		Name:  "discovery.dht.port",
		Usage: "The port to bind DHT to (by default, random port will be used)",
		Value: 0,
	}
	// FlagDHTProtocol protocol for DHT to use.
	FlagDHTProtocol = cli.StringFlag{
		Name:  "discovery.dht.proto",
		Usage: "Protocol to use with DHT. Options: { udp, tcp }",
		Value: "tcp",
	}
	// FlagDHTBootstrapPeers DHT bootstrap peer nodes list.
	FlagDHTBootstrapPeers = cli.StringSliceFlag{
		Name:  "discovery.dht.peers",
		Usage: `Peer URL(s) for DHT bootstrap (e.g. /ip4/127.0.0.1/tcp/1234/p2p/QmNUZRp1zrk8i8TpfyeDZ9Yg3C4PjZ5o61yao3YhyY1TE8") separated by comma. They will tell us about the other nodes in the network.`,
		Value: cli.NewStringSlice(),
	}

	// FlagBindAddress IP address to bind to.
	FlagBindAddress = cli.StringFlag{
		Name:  "bind.address",
		Usage: "IP address to bind provided services to",
		Value: "0.0.0.0",
	}
	// FlagFeedbackURL URL of Feedback API.
	FlagFeedbackURL = cli.StringFlag{
		Name:  "feedback.url",
		Usage: "URL of Feedback API",
		Value: "https://feedback.mysterium.network",
	}
	// FlagFirewallKillSwitch always blocks non-tunneled outgoing consumer traffic.
	FlagFirewallKillSwitch = cli.BoolFlag{
		Name:  "firewall.killSwitch.always",
		Usage: "Always block non-tunneled outgoing consumer traffic",
	}
	// FlagFirewallProtectedNetworks protects provider's networks from access via VPN
	FlagFirewallProtectedNetworks = cli.StringFlag{
		Name:  "firewall.protected.networks",
		Usage: "List of comma separated (no spaces) subnets to be protected from access via VPN",
		Value: "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.0/8",
	}
	// FlagShaperEnabled enables bandwidth limitation.
	FlagShaperEnabled = cli.BoolFlag{
		Name:  "shaper.enabled",
		Usage: "Limit service bandwidth",
	}
	// FlagShaperBandwidth set the bandwidth limit.
	FlagShaperBandwidth = cli.Uint64Flag{
		Name:  "shaper.bandwidth",
		Usage: "Set the bandwidth limit in Kbytes",
		Value: 6250,
	}
	// FlagKeystoreLightweight determines the scrypt memory complexity.
	FlagKeystoreLightweight = cli.BoolFlag{
		Name:  "keystore.lightweight",
		Usage: "Determines the scrypt memory complexity. If set to true, will use 4MB blocks instead of the standard 256MB ones",
		Value: true,
	}
	// FlagLogHTTP enables HTTP payload logging.
	FlagLogHTTP = cli.BoolFlag{
		Name:  "log.http",
		Usage: "Enable HTTP payload logging",
	}
	// FlagLogLevel logger level.
	FlagLogLevel = cli.StringFlag{
		Name: "log-level",
		Usage: func() string {
			allLevels := []string{
				zerolog.TraceLevel.String(),
				zerolog.DebugLevel.String(),
				zerolog.InfoLevel.String(),
				zerolog.WarnLevel.String(),
				zerolog.FatalLevel.String(),
				zerolog.PanicLevel.String(),
				zerolog.Disabled.String(),
			}
			return fmt.Sprintf("Set the logging level (%s)", strings.Join(allLevels, "|"))
		}(),
		Value: zerolog.DebugLevel.String(),
	}
	// FlagVerbose enables verbose logging.
	FlagVerbose = cli.BoolFlag{
		Name:  "verbose",
		Usage: "Enable verbose logging",
		Value: false,
	}
	// FlagOpenvpnBinary openvpn binary to use for OpenVPN connections.
	FlagOpenvpnBinary = cli.StringFlag{
		Name:  "openvpn.binary",
		Usage: "openvpn binary to use for OpenVPN connections",
		Value: "openvpn",
	}
	// FlagQualityType quality oracle adapter.
	FlagQualityType = cli.StringFlag{
		Name:  "quality.type",
		Usage: "Quality Oracle adapter. Options:  (elastic, morqa, none - opt-out from sending quality metrics)",
		Value: "morqa",
	}
	// FlagQualityAddress quality oracle URL.
	FlagQualityAddress = cli.StringFlag{
		Name: "quality.address",
		Usage: fmt.Sprintf(
			"Address of specific Quality Oracle adapter given in '--%s'",
			FlagQualityType.Name,
		),
		Value: "https://quality.mysterium.network/api/v3",
	}
	// FlagTequilapiAddress IP address of interface to listen for incoming connections.
	FlagTequilapiAddress = cli.StringFlag{
		Name:  "tequilapi.address",
		Usage: "IP address to bind API to",
		Value: "127.0.0.1",
	}
	// FlagTequilapiAllowedHostnames Restrict hostnames in requests' Host header to following domains.
	FlagTequilapiAllowedHostnames = cli.StringFlag{
		Name:  "tequilapi.allowed-hostnames",
		Usage: "Comma separated list of allowed domains. Prepend value with dot for wildcard mask",
		Value: ".localhost, localhost, .localdomain",
	}
	// FlagTequilapiPort port for listening for incoming API requests.
	FlagTequilapiPort = cli.IntFlag{
		Name:  "tequilapi.port",
		Usage: "Port for listening incoming API requests",
		Value: 4050,
	}
	// FlagTequilapiDebugMode debug mode for tequilapi.
	FlagTequilapiDebugMode = cli.BoolFlag{
		Name:  "tequilapi.debug",
		Usage: "Starts tequilapi in debug mode",
		Value: false,
	}
	// FlagTequilapiUsername username for API authentication.
	FlagTequilapiUsername = cli.StringFlag{
		Name:  "tequilapi.auth.username",
		Usage: "Default username for API authentication",
		Value: "myst",
	}
	// FlagTequilapiPassword username for API authentication.
	FlagTequilapiPassword = cli.StringFlag{
		Name:  "tequilapi.auth.password",
		Usage: "Default password for API authentication",
		Value: "mystberry",
	}
	// FlagPProfEnable enables pprof via TequilAPI.
	FlagPProfEnable = cli.BoolFlag{
		Name:  "pprof.enable",
		Usage: "Enables pprof",
		Value: false,
	}
	// FlagUserMode allows running node under current user without sudo.
	FlagUserMode = cli.BoolFlag{
		Name:  "usermode",
		Usage: "Run as a regular user. Delegate elevated commands to the supervisor.",
		Value: false,
	}

	// FlagDVPNMode allows running node in a kernelspace without establishing system-wite tunnels.
	FlagDVPNMode = cli.BoolFlag{
		Name:  "dvpnmode",
		Usage: "Run in a kernelspace without establishing system-wite tunnels",
		Value: false,
	}

	// FlagProxyMode allows running node under current user as a proxy.
	FlagProxyMode = cli.BoolFlag{
		Name:  "proxymode",
		Usage: "Run as a regular user as a proxy",
		Value: false,
	}

	// FlagUserspace allows running a node without privileged permissions.
	FlagUserspace = cli.BoolFlag{
		Name:  "userspace",
		Usage: "Run a node without privileged permissions",
		Value: false,
	}

	// FlagVendorID identifies 3rd party vendor (distributor) of Mysterium node.
	FlagVendorID = cli.StringFlag{
		Name: "vendor.id",
		Usage: "Marks vendor (distributor) of the node for collecting statistics. " +
			"3rd party vendors may use their own identifier here.",
	}
	// FlagLauncherVersion is used for reporting the version of a Launcher.
	FlagLauncherVersion = cli.StringFlag{
		Name:  "launcher.ver",
		Usage: "Report the version of a launcher for statistics",
	}

	// FlagP2PListenPorts sets manual ports for p2p connections.
	// TODO: remove the deprecated flag once all users stop to use it.
	FlagP2PListenPorts = cli.StringFlag{
		Name:  "p2p.listen.ports",
		Usage: "Deprecated flag, use --udp.ports to set range of listen ports",
		Value: "0:0",
	}

	// FlagConsumer sets to run as consumer only which allows to skip bootstrap for some of the dependencies.
	FlagConsumer = cli.BoolFlag{
		Name:  "consumer",
		Usage: "Run in consumer mode only.",
		Value: false,
	}

	// FlagDefaultCurrency sets the default currency used in node
	FlagDefaultCurrency = cli.StringFlag{
		Name:   metadata.FlagNames.DefaultCurrency,
		Usage:  "Default currency used in node and apps that depend on it",
		Value:  metadata.DefaultNetwork.DefaultCurrency,
		Hidden: true,
	}

	// FlagDocsURL sets the URL which leads to node documentation.
	FlagDocsURL = cli.StringFlag{
		Name:   "docs-url",
		Usage:  "URL leading to node documentation",
		Value:  "https://docs.mysterium.network",
		Hidden: true,
	}

	// FlagDNSResolutionHeadstart sets the dns resolution head start for swarm dialer.
	FlagDNSResolutionHeadstart = cli.DurationFlag{
		Name:   "dns-resolution-headstart",
		Usage:  "the headstart we give DNS lookups versus IP lookups",
		Value:  time.Millisecond * 1500,
		Hidden: true,
	}

	// FlagResidentCountry sets the resident country
	FlagResidentCountry = cli.StringFlag{
		Name:  "resident-country",
		Usage: "set resident country. If not set initially a default country will be resolved.",
	}

	// FlagWireguardMTU sets Wireguard myst interface MTU.
	FlagWireguardMTU = cli.IntFlag{
		Name:  "wireguard.mtu",
		Usage: "Wireguard interface MTU",
	}
)
View Source
var (
	// FlagPaymentsMaxHermesFee represents the max hermes fee.
	FlagPaymentsMaxHermesFee = cli.IntFlag{
		Name:  "payments.hermes.max.fee",
		Value: 3000,
		Usage: "The max fee that we'll accept from an hermes. In percentiles. 3000 means 30%",
	}
	// FlagPaymentsBCTimeout represents the BC call timeout.
	FlagPaymentsBCTimeout = cli.DurationFlag{
		Name:  "payments.bc.timeout",
		Value: time.Second * 30,
		Usage: "The duration we'll wait before timing out BC calls.",
	}
	// FlagPaymentsHermesPromiseSettleThreshold represents the percentage of balance left when we go for promise settling.
	FlagPaymentsHermesPromiseSettleThreshold = cli.Float64Flag{
		Name:  "payments.hermes.promise.threshold",
		Value: 0.1,
		Usage: "The percentage of balance before we settle promises",
	}
	// FlagPaymentsHermesPromiseSettleTimeout represents the time we wait for confirmation of the promise settlement.
	FlagPaymentsHermesPromiseSettleTimeout = cli.DurationFlag{
		Name:   "payments.hermes.settle.timeout",
		Value:  time.Minute * 3,
		Usage:  "The duration we'll wait before timing out our wait for promise settle.",
		Hidden: true,
	}
	// FlagPaymentsHermesPromiseSettleCheckInterval represents the time for polling for confirmation of the promise settlement.
	FlagPaymentsHermesPromiseSettleCheckInterval = cli.DurationFlag{
		Name:   "payments.hermes.settle.check-interval",
		Value:  time.Second * 30,
		Usage:  "The duration we'll wait before trying to fetch new events.",
		Hidden: true,
	}
	// FlagPaymentsLongBalancePollInterval determines how often we resync balance on chain.
	FlagPaymentsLongBalancePollInterval = cli.DurationFlag{
		Name:   "payments.balance-long-poll.interval",
		Value:  time.Hour * 1,
		Usage:  "The duration we'll wait before trying to fetch new balance.",
		Hidden: true,
	}
	// FlagPaymentsFastBalancePollInterval determines how often we resync balance on chain after on chain events.
	FlagPaymentsFastBalancePollInterval = cli.DurationFlag{
		Name:   "payments.balance-short-poll.interval",
		Value:  time.Minute,
		Usage:  "The duration we'll wait before trying to fetch new balance.",
		Hidden: true,
	}
	// FlagPaymentsFastBalancePollTimeout determines how long we try to resync balance on chain after on chain events.
	FlagPaymentsFastBalancePollTimeout = cli.DurationFlag{
		Name:   "payments.balance-short-poll.timeout",
		Value:  time.Minute * 10,
		Usage:  "The duration we'll wait before giving up trying to fetch new balance.",
		Hidden: true,
	}
	// FlagPaymentsZeroStakeUnsettledAmount determines the minimum amount of myst that we will settle automatically if zero stake is used.
	FlagPaymentsZeroStakeUnsettledAmount = cli.Float64Flag{
		Name:  "payments.zero-stake-unsettled-amount",
		Value: 5.0,
		Usage: "The settling threshold if provider uses a zero stake",
	}
	// FlagPaymentsPromiseSettleMaxFeeThreshold represents the max percentage of the settlement that will be acceptable to pay in transaction fees.
	FlagPaymentsPromiseSettleMaxFeeThreshold = cli.Float64Flag{
		Name:  "payments.settle.max-fee-percentage",
		Value: 0.05,
		Usage: "The max percentage we allow to pay in fees when automatically settling promises.",
	}
	// FlagPaymentsUnsettledMaxAmount determines the maximum amount of myst for which we will consider the fee threshold.
	FlagPaymentsUnsettledMaxAmount = cli.Float64Flag{
		Name:  "payments.unsettled.max-amount",
		Value: 20.0,
		Usage: "The maximum amount of unsettled myst, after that we will always try to settle.",
	}
	// FlagPaymentsRegistryTransactorPollInterval The duration we'll wait before calling transactor to check for new status updates.
	FlagPaymentsRegistryTransactorPollInterval = cli.DurationFlag{
		Name:   "payments.registry-transactor-poll.interval",
		Value:  time.Second * 20,
		Usage:  "The duration we'll wait before calling transactor to check for new status updates",
		Hidden: true,
	}
	// FlagPaymentsRegistryTransactorPollTimeout The duration we'll wait before polling up the transactors registration status again.
	FlagPaymentsRegistryTransactorPollTimeout = cli.DurationFlag{
		Name:   "payments.registry-transactor-poll.timeout",
		Value:  time.Minute * 20,
		Usage:  "The duration we'll wait before giving up on transactors registration status",
		Hidden: true,
	}
	// FlagPaymentsConsumerDataLeewayMegabytes sets the data amount the consumer agrees to pay before establishing a session
	FlagPaymentsConsumerDataLeewayMegabytes = cli.Uint64Flag{
		Name:  metadata.FlagNames.PaymentsDataLeewayMegabytes,
		Usage: "sets the data amount the consumer agrees to pay before establishing a session",
		Value: metadata.MainnetDefinition.Payments.DataLeewayMegabytes,
	}
	// FlagPaymentsHermesStatusRecheckInterval sets how often we re-check the hermes status on bc. Higher values allow for less bc lookups but increase the risk for provider.
	FlagPaymentsHermesStatusRecheckInterval = cli.DurationFlag{
		Hidden: true,
		Name:   "payments.provider.hermes-status-recheck-interval",
		Usage:  "sets the hermes status recheck interval. Setting this to a lower value will decrease potential loss in case of Hermes getting locked.",
		Value:  time.Hour * 2,
	}
	// FlagOffchainBalanceExpiration sets how often we re-check offchain balance on hermes when balance is depleting
	FlagOffchainBalanceExpiration = cli.DurationFlag{
		Hidden: true,
		Name:   "payments.consumer.offchain-expiration",
		Usage:  "after syncing offchain balance, how long should node wait for next check to occur",
		Value:  time.Minute * 30,
	}
	// FlagPaymentsDuringSessionDebug sets if we're in debug more for the payments done in a VPN session.
	FlagPaymentsDuringSessionDebug = cli.BoolFlag{
		Name:   "payments.during-session-debug",
		Usage:  "Set debug mode for payments made during a session, it will bypass any price validation and allow absurd prices during sessions",
		Value:  false,
		Hidden: true,
	}
	// FlagPaymentsAmountDuringSessionDebug sets the amount of MYST sent during session debug
	FlagPaymentsAmountDuringSessionDebug = cli.Uint64Flag{
		Name:   "payments.amount-during-session-debug-amount",
		Usage:  "Set amount to pay during session debug",
		Value:  5000000000000000000,
		Hidden: true,
	}

	// FlagObserverAddress address of Observer service.
	FlagObserverAddress = cli.StringFlag{
		Name:  metadata.FlagNames.ObserverAddress,
		Usage: "full address of the observer service",
		Value: metadata.DefaultNetwork.ObserverAddress,
	}

	// FlagPaymentsLimitUnpaidInvoiceValue sets the upper limit of session payment value before forcing an invoice
	FlagPaymentsLimitUnpaidInvoiceValue = cli.StringFlag{
		Name:  "payments.provider.max-unpaid-invoice-value-limit",
		Usage: "sets the max upper limit of session payment value before forcing an invoice. If this value is exceeded before a payment interval is reached, an invoice is sent.",
		Value: "30000000000000000",
	}

	// FlagPaymentsUnpaidInvoiceValue sets the starting max limit of session payment value before forcing an invoice
	FlagPaymentsUnpaidInvoiceValue = cli.StringFlag{
		Name:   "payments.provider.max-unpaid-invoice-value",
		Usage:  "sets the starting upper limit of session payment value before forcing an invoice. If this value is exceeded before a payment interval is reached, an invoice is sent.",
		Value:  "3000000000000000",
		Hidden: true,
	}

	// FlagPaymentsProviderInvoiceFrequency determines how often the provider sends invoices.
	FlagPaymentsProviderInvoiceFrequency = cli.DurationFlag{
		Name:   "payments.provider.invoice-frequency",
		Value:  time.Second * 5,
		Usage:  "Determines how often the provider sends invoices.",
		Hidden: true,
	}

	// FlagPaymentsLimitProviderInvoiceFrequency determines how often the provider sends invoices.
	FlagPaymentsLimitProviderInvoiceFrequency = cli.DurationFlag{
		Name:  "payments.provider.invoice-frequency-limit",
		Value: time.Minute * 5,
		Usage: "Determines how often the provider sends invoices.",
	}
)
View Source
var (
	// FlagAccessPolicyAddress Trust oracle URL for retrieving access policies.
	FlagAccessPolicyAddress = cli.StringFlag{
		Name:  metadata.FlagNames.AccessPolicyOracleAddress,
		Usage: "URL of trust oracle endpoint for retrieving lists of access policies",
		Value: metadata.DefaultNetwork.AccessPolicyOracleAddress,
	}
	// FlagAccessPolicyFetchInterval policy list fetch interval.
	FlagAccessPolicyFetchInterval = cli.DurationFlag{
		Name:  "access-policy.fetch",
		Usage: `Proposal fetch interval { "30s", "3m", "1h20m30s" }`,
		Value: 10 * time.Minute,
	}
	// FlagAccessPolicyFetchingEnabled policy list fetch enable
	FlagAccessPolicyFetchingEnabled = cli.BoolFlag{
		Name:  "access-policy.fetching-enabled",
		Usage: "Enable periodic fetching of access policies and saving to memory (allows support for whitelist types other than identity)",
		Value: false,
	}
)
View Source
var (
	// FlagOpenvpnProtocol protocol for OpenVPN to use.
	FlagOpenvpnProtocol = cli.StringFlag{
		Name:  "openvpn.proto",
		Usage: "OpenVPN protocol to use. Options: { udp, tcp }",
		Value: "udp",
	}
	// FlagOpenvpnPort port for OpenVPN to use.
	FlagOpenvpnPort = cli.IntFlag{
		Name:  "openvpn.port",
		Usage: "OpenVPN port to use. If not specified, random port will be used",
		Value: 0,
	}
	// FlagOpenvpnSubnet OpenVPN subnet that will be used for connecting clients.
	FlagOpenvpnSubnet = cli.StringFlag{
		Name:  "openvpn.subnet",
		Usage: "OpenVPN subnet that will be used to connecting VPN clients",
		Value: "10.8.0.0",
	}
	// FlagOpenvpnNetmask OpenVPN subnet netmask.
	FlagOpenvpnNetmask = cli.StringFlag{
		Name:  "openvpn.netmask",
		Usage: "OpenVPN subnet netmask",
		Value: "255.255.255.0",
	}
	// FlagOpenVPNAccessPolicies a comma-separated list of access policies that determines allowed identities to use the service.
	FlagOpenVPNAccessPolicies = cli.StringFlag{
		Name:  "openvpn.access-policies",
		Usage: "Comma separated list that determines the access policies of the OpenVPN service.",
	}
)
View Source
var (
	// FlagIdentity keystore's identity.
	FlagIdentity = cli.StringFlag{
		Name:  "identity",
		Usage: "Keystore's identity used to provide service. If not given identity will be created automatically",
		Value: "",
	}
	// FlagIdentityPassphrase passphrase to unlock the identity.
	FlagIdentityPassphrase = cli.StringFlag{
		Name:  "identity.passphrase",
		Usage: "Used to unlock keystore's identity",
		Value: "",
	}

	// FlagAgreedTermsConditions agree with terms & conditions.
	FlagAgreedTermsConditions = cli.BoolFlag{
		Name:  "agreed-terms-and-conditions",
		Usage: "Agree with terms & conditions for consumer, provider or both depending on the command executed",
	}

	// FlagAccessPolicyList a comma-separated list of access policies that determines allowed identities to use the service.
	FlagAccessPolicyList = cli.StringFlag{
		Name:  "access-policy.list",
		Usage: "Comma separated list that determines the access policies applied to provide service.",
		Value: "",
	}

	// FlagPaymentPriceGiB sets the price/GiB to provided service.
	FlagPaymentPriceGiB = cli.Float64Flag{
		Name:  "payment.price-gib",
		Usage: "Sets the price/GiB applied to provider service.",
		Value: 0.1,
	}
	// FlagPaymentPriceHour sets the price/hour to provided service.
	FlagPaymentPriceHour = cli.Float64Flag{
		Name:  "payment.price-hour",
		Usage: "Sets the price/hour applied to provider service.",
		Value: 0.00006,
	}

	// FlagActiveServices a comma-separated list of active services.
	FlagActiveServices = cli.StringFlag{
		Name:  "active-services",
		Usage: "Comma separated list of active services.",
		Value: strings.Join([]string{"scraping", "data_transfer", "dvpn", "monitoring"}, ","),
	}

	// FlagStoppedServices a comma-separated list of stopped services.
	FlagStoppedServices = cli.StringFlag{
		Name:   "stopped-services",
		Usage:  "Comma separated list of stopped services.",
		Value:  strings.Join([]string{}, ","),
		Hidden: true,
	}
)
View Source
var (
	// FlagWireguardListenPorts range of listen ports.
	// TODO: remove the deprecated flag once all users stop to use it.
	FlagWireguardListenPorts = cli.StringFlag{
		Name:  "wireguard.listen.ports",
		Usage: "Deprecated flag, use --udp.ports to set range of listen ports",
		Value: "0:0",
	}
	// FlagWireguardListenSubnet subnet to be used by the wireguard service.
	FlagWireguardListenSubnet = cli.StringFlag{
		Name:  "wireguard.allowed.subnet",
		Usage: "Subnet to be used by the wireguard service",
		Value: "10.182.0.0/16",
	}
	// FlagWireguardAccessPolicies a comma-separated list of access policies that determines allowed identities to use the service.
	FlagWireguardAccessPolicies = cli.StringFlag{
		Name:  "wireguard.access-policies",
		Usage: "Comma separated list that determines the access policies of the wireguard service.",
	}
)
View Source
var (
	// FlagTransactorAddress transactor URL.
	FlagTransactorAddress = cli.StringFlag{
		Name:  metadata.FlagNames.TransactorAddress,
		Usage: "Transactor URL address",
		Value: metadata.DefaultNetwork.TransactorAddress,
	}
	// FlagTransactorProviderMaxRegistrationAttempts determines the number of registration attempts that the provider will attempt before giving up.
	FlagTransactorProviderMaxRegistrationAttempts = cli.IntFlag{
		Name:  "transactor.provider.max-registration-attempts",
		Usage: "the max attempts the provider will make to register before giving up",
		Value: 10,
	}
	// FlagTransactorFeesValidTime The duration we will consider transactor fees valid for.
	FlagTransactorFeesValidTime = cli.DurationFlag{
		Name:   "payments.transactor.fees-valid-time",
		Value:  30 * time.Second,
		Usage:  "The duration we will consider transactor fees valid for (more than 5 minutes is likely to fail)",
		Hidden: true,
	}
	// FlagProviderTryFreeRegistration if set to true, the provider will try to register for free.
	FlagProviderTryFreeRegistration = cli.BoolFlag{
		Name:  "transactor.provider.try-free-registration",
		Usage: "if set to true, the provider will try to register for free. ",
		Value: false,
	}
)
View Source
var (
	// FlagUIFeatures toggle NodeUI features
	FlagUIFeatures = cli.StringFlag{
		Name:  "ui.features",
		Usage: "Enable NodeUI features. Multiple features are joined by comma (e.g feature1,feature2,...)",
		Value: "",
	}
	// FlagUIEnable enables built-in web UI for node.
	FlagUIEnable = cli.BoolFlag{
		Name:  "ui.enable",
		Usage: "Enables the Web UI",
		Value: true,
	}
	// FlagUIAddress IP address of interface to listen for incoming connections.
	FlagUIAddress = cli.StringFlag{
		Name:  "ui.address",
		Usage: "IP address to bind Web UI to. Address can be comma delimited: '192.168.1.10,192.168.1.20'. (default - 127.0.0.1 and local LAN IP)",
		Value: "",
	}
	// FlagUIPort runs web UI on the specified port.
	FlagUIPort = cli.IntFlag{
		Name:  "ui.port",
		Usage: "The port to run Web UI on",
		Value: 4449,
	}
)
View Source
var Current = NewConfig()

Current global configuration instance.

View Source
var (
	// FlagAffiliatorAddress affiliator URL.
	FlagAffiliatorAddress = cli.StringFlag{
		Name:  metadata.FlagNames.AffiliatorAddress,
		Usage: "Affiliator URL address",
		Value: metadata.DefaultNetwork.AffiliatorAddress,
	}
)
View Source
var (
	// FlagNodeVersion - stores node version to discover a fact of node update
	FlagNodeVersion = cli.StringFlag{
		Name:   "node.version",
		Usage:  "",
		Value:  "",
		Hidden: true,
	}
)
View Source
var (
	// FlagNoopAccessPolicies a comma-separated list of access policies that determines allowed identities to use the service.
	FlagNoopAccessPolicies = cli.StringFlag{
		Name:   "noop.access-policies",
		Usage:  "Comma separated list that determines the access policies of the noop service.",
		Hidden: true,
	}
)
View Source
var FlagPilvytisAddress = cli.StringFlag{
	Name:  metadata.FlagNames.PilvytisAddress,
	Usage: "full address of the pilvytis service",
	Value: metadata.DefaultNetwork.PilvytisAddress,
}

FlagPilvytisAddress address of Pilvytis service.

View Source
var FlagQUICCert = cli.StringFlag{
	Name:  "quic.cert",
	Usage: "Cert to be used by the QUIC service",
	Value: "",
}

FlagQUICCert defines cert to be used by the QUIC service.

View Source
var FlagQUICDomain = cli.StringFlag{
	Name:  "quic.domain",
	Usage: "Domain to be used by the QUIC service",
	Value: "",
}

FlagQUICDomain defines domain to be used by the QUIC connections.

View Source
var FlagQUICKey = cli.StringFlag{
	Name:  "quic.key",
	Usage: "Key to be used by the QUIC service",
	Value: "",
}

FlagQUICKey defines key to be used by the QUIC service.

View Source
var FlagQUICLogin = cli.StringFlag{
	Name:  "quic.login",
	Usage: "Login to be used by the QUIC service",
	Value: "mystuser",
}

FlagQUICLogin defines login to be used by the QUIC service.

View Source
var FlagQUICPassword = cli.StringFlag{
	Name:  "quic.password",
	Usage: "Password to be used by the QUIC service",
	Value: "mystpass",
}

FlagQUICPassword defines password to be used by the QUIC service.

View Source
var (
	// FlagSSEEnable enable Server-Sent Events.
	FlagSSEEnable = cli.BoolFlag{
		Name:  "sse.enable",
		Usage: "Enable the Server-Sent Events mode",
		Value: true,
	}
)

Functions

func AppTopicConfig

func AppTopicConfig(configKey string) string

AppTopicConfig returns event bus topic for the given config key to listen for its updates.

func GetBigInt

func GetBigInt(flag cli.StringFlag) *big.Int

GetBigInt shorthand for getting and parsing a configuration value for cli.StringFlag that's a big.Int.

func GetBool

func GetBool(flag cli.BoolFlag) bool

GetBool shorthand for getting current configuration value for cli.BoolFlag.

func GetDuration

func GetDuration(flag cli.DurationFlag) time.Duration

GetDuration shorthand for getting current configuration value for cli.DurationFlag.

func GetFloat64

func GetFloat64(flag cli.Float64Flag) float64

GetFloat64 shorthand for getting current configuration value for cli.Uint64Flag.

func GetInt

func GetInt(flag cli.IntFlag) int

GetInt shorthand for getting current configuration value for cli.IntFlag.

func GetInt64

func GetInt64(flag cli.Int64Flag) int64

GetInt64 shorthand for getting current configuration value for cli.IntFlag.

func GetString

func GetString(flag cli.StringFlag) string

GetString shorthand for getting current configuration value for cli.StringFlag.

func GetStringSlice

func GetStringSlice(flag cli.StringSliceFlag) []string

GetStringSlice shorthand for getting current configuration value for cli.StringSliceFlag.

func GetUInt64

func GetUInt64(flag cli.Uint64Flag) uint64

GetUInt64 shorthand for getting current configuration value for cli.Uint64Flag.

func ParseFlagPilvytis

func ParseFlagPilvytis(ctx *cli.Context)

ParseFlagPilvytis func fills the pilvytis options from CLI context.

func ParseFlagsAffiliator

func ParseFlagsAffiliator(ctx *cli.Context)

ParseFlagsAffiliator function fills in affiliator options from CLI context

func ParseFlagsBlockchainNetwork

func ParseFlagsBlockchainNetwork(ctx *cli.Context)

ParseFlagsBlockchainNetwork function fills in directory options from CLI context

func ParseFlagsChains

func ParseFlagsChains(ctx *cli.Context)

ParseFlagsChains function fills in chain options from CLI context.

func ParseFlagsDirectory

func ParseFlagsDirectory(ctx *cli.Context)

ParseFlagsDirectory function fills in directory options from CLI context

func ParseFlagsLocation

func ParseFlagsLocation(ctx *cli.Context)

ParseFlagsLocation function fills in location options from CLI context.

func ParseFlagsMMN

func ParseFlagsMMN(ctx *cli.Context)

ParseFlagsMMN function fills in MMN options from CLI context.

func ParseFlagsNetwork

func ParseFlagsNetwork(ctx *cli.Context)

ParseFlagsNetwork function fills in directory options from CLI context

func ParseFlagsNode

func ParseFlagsNode(ctx *cli.Context)

ParseFlagsNode function fills in node options from CLI context

func ParseFlagsPayments

func ParseFlagsPayments(ctx *cli.Context)

ParseFlagsPayments function fills in payments options from CLI context.

func ParseFlagsPolicy

func ParseFlagsPolicy(ctx *cli.Context)

ParseFlagsPolicy function fills in PolicyOracle options from CLI context.

func ParseFlagsSSE

func ParseFlagsSSE(ctx *cli.Context)

ParseFlagsSSE function fills in SSE options from CLI context

func ParseFlagsServiceNoop

func ParseFlagsServiceNoop(ctx *cli.Context)

ParseFlagsServiceNoop parses CLI flags and registers value to configuration

func ParseFlagsServiceOpenvpn

func ParseFlagsServiceOpenvpn(ctx *cli.Context)

ParseFlagsServiceOpenvpn parses CLI flags and registers value to configuration

func ParseFlagsServiceQuic

func ParseFlagsServiceQuic(ctx *cli.Context)

ParseFlagsServiceQuic parses CLI flags and registers value to configuration.

func ParseFlagsServiceStart

func ParseFlagsServiceStart(ctx *cli.Context)

ParseFlagsServiceStart parses service start CLI flags and registers values to the configuration

func ParseFlagsServiceWireguard

func ParseFlagsServiceWireguard(ctx *cli.Context)

ParseFlagsServiceWireguard parses CLI flags and registers value to configuration

func ParseFlagsTransactor

func ParseFlagsTransactor(ctx *cli.Context)

ParseFlagsTransactor function fills in transactor options from CLI context

func ParseFlagsUI

func ParseFlagsUI(ctx *cli.Context)

ParseFlagsUI parse Node UI flags

func RegisterFlagNodeVersion

func RegisterFlagNodeVersion(flags *[]cli.Flag)

RegisterFlagNodeVersion register Node version flags to the list

func RegisterFlagsAffiliator

func RegisterFlagsAffiliator(flags *[]cli.Flag)

RegisterFlagsAffiliator function register network flags to flag list

func RegisterFlagsBlockchainNetwork

func RegisterFlagsBlockchainNetwork(flags *[]cli.Flag)

RegisterFlagsBlockchainNetwork function registers blockchain network flags to flag list

func RegisterFlagsChains

func RegisterFlagsChains(flags *[]cli.Flag)

RegisterFlagsChains function registers chain flags to flag list.

func RegisterFlagsDirectory

func RegisterFlagsDirectory(flags *[]cli.Flag) error

RegisterFlagsDirectory function register directory flags to flag list

func RegisterFlagsLocation

func RegisterFlagsLocation(flags *[]cli.Flag)

RegisterFlagsLocation function registers location flags to flag list.

func RegisterFlagsMMN

func RegisterFlagsMMN(flags *[]cli.Flag)

RegisterFlagsMMN function registers MMN flags to flag list.

func RegisterFlagsNetwork

func RegisterFlagsNetwork(flags *[]cli.Flag)

RegisterFlagsNetwork function register network flags to flag list

func RegisterFlagsNode

func RegisterFlagsNode(flags *[]cli.Flag) error

RegisterFlagsNode function register node flags to flag list

func RegisterFlagsPayments

func RegisterFlagsPayments(flags *[]cli.Flag)

RegisterFlagsPayments function register payments flags to flag list.

func RegisterFlagsPilvytis

func RegisterFlagsPilvytis(flags *[]cli.Flag)

RegisterFlagsPilvytis func registers pilvytis flags to flag list.

func RegisterFlagsPolicy

func RegisterFlagsPolicy(flags *[]cli.Flag)

RegisterFlagsPolicy function registers Policy Oracle flags to flag list.

func RegisterFlagsSSE

func RegisterFlagsSSE(flags *[]cli.Flag)

RegisterFlagsSSE function register SSE flags to flag list

func RegisterFlagsServiceNoop

func RegisterFlagsServiceNoop(flags *[]cli.Flag)

RegisterFlagsServiceNoop function register Wireguard flags to flag list

func RegisterFlagsServiceOpenvpn

func RegisterFlagsServiceOpenvpn(flags *[]cli.Flag)

RegisterFlagsServiceOpenvpn registers OpenVPN CLI flags for parsing them later

func RegisterFlagsServiceQuic

func RegisterFlagsServiceQuic(flags *[]cli.Flag)

RegisterFlagsServiceQuic function register QUIC flags to flag list.

func RegisterFlagsServiceStart

func RegisterFlagsServiceStart(flags *[]cli.Flag)

RegisterFlagsServiceStart registers CLI flags used to start a service.

func RegisterFlagsServiceWireguard

func RegisterFlagsServiceWireguard(flags *[]cli.Flag)

RegisterFlagsServiceWireguard function register Wireguard flags to flag list

func RegisterFlagsTransactor

func RegisterFlagsTransactor(flags *[]cli.Flag)

RegisterFlagsTransactor function register network flags to flag list

func RegisterFlagsUI

func RegisterFlagsUI(flags *[]cli.Flag)

RegisterFlagsUI register Node UI flags to the list

func SearchMap

func SearchMap(source map[string]interface{}, path []string) interface{}

SearchMap recursively searches for a value for path in source map. Returns nil if not found. Note: This assumes that the path entries and map keys are lower cased.

func ValidateAddressFlags

func ValidateAddressFlags(flags ...cli.StringFlag)

ValidateAddressFlags validates given address flags for public exposure

func ValidateWireguardMTUFlag

func ValidateWireguardMTUFlag() error

ValidateWireguardMTUFlag validates given mtu flag

Types

type BlockchainNetwork

type BlockchainNetwork string

BlockchainNetwork defines a blockchain network

var (
	// Mainnet defines the mainnet blockchain network
	Mainnet BlockchainNetwork = "mainnet"
	// Testnet defines the testnet blockchain network
	Testnet BlockchainNetwork = "testnet"
	// Localnet defines the localnet blockchain network
	Localnet BlockchainNetwork = "localnet"
)

func GetBlockchainNetwork

func GetBlockchainNetwork(flag cli.StringFlag) BlockchainNetwork

GetBlockchainNetwork shorthand for getting current configuration value for blockchain network.

func ParseBlockchainNetwork

func ParseBlockchainNetwork(network string) (BlockchainNetwork, error)

ParseBlockchainNetwork parses a string argument into blockchain network

func (BlockchainNetwork) IsLocalnet

func (n BlockchainNetwork) IsLocalnet() bool

IsLocalnet returns whether the blockchain network is localnet or not

func (BlockchainNetwork) IsMainnet

func (n BlockchainNetwork) IsMainnet() bool

IsMainnet returns whether the blockchain network is mainnet or not

func (BlockchainNetwork) IsTestnet

func (n BlockchainNetwork) IsTestnet() bool

IsTestnet returns whether the blockchain network is testnet or not

type Config

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

Config stores application configuration in 3 separate maps (listed from the lowest priority to the highest):

• Default values

• User configuration (config.toml)

• CLI flags

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration instance.

func (*Config) EnableEventPublishing

func (cfg *Config) EnableEventPublishing(eb eventbus.EventBus)

EnableEventPublishing enables config event publishing to the event bus.

func (*Config) Get

func (cfg *Config) Get(key string) interface{}

Get returns stored config value as-is.

func (*Config) GetBool

func (cfg *Config) GetBool(key string) bool

GetBool returns config value as bool.

func (*Config) GetConfig

func (cfg *Config) GetConfig() map[string]interface{}

GetConfig returns current configuration.

func (*Config) GetDefaultConfig

func (cfg *Config) GetDefaultConfig() map[string]interface{}

GetDefaultConfig returns default configuration.

func (*Config) GetDuration

func (cfg *Config) GetDuration(key string) time.Duration

GetDuration returns config value as duration.

func (*Config) GetFloat64

func (cfg *Config) GetFloat64(key string) float64

GetFloat64 returns config value as float64.

func (*Config) GetInt

func (cfg *Config) GetInt(key string) int

GetInt returns config value as int.

func (*Config) GetInt64

func (cfg *Config) GetInt64(key string) int64

GetInt64 returns config value as int64.

func (*Config) GetString

func (cfg *Config) GetString(key string) string

GetString returns config value as string.

func (*Config) GetStringSlice

func (cfg *Config) GetStringSlice(key string) []string

GetStringSlice returns config value as []string.

func (*Config) GetUInt64

func (cfg *Config) GetUInt64(key string) uint64

GetUInt64 returns config value as uint64.

func (*Config) GetUserConfig

func (cfg *Config) GetUserConfig() map[string]interface{}

GetUserConfig returns user configuration.

func (*Config) LoadUserConfig

func (cfg *Config) LoadUserConfig(location string) error

LoadUserConfig loads and remembers user config location.

func (*Config) ParseBlockchainNetworkFlag

func (cfg *Config) ParseBlockchainNetworkFlag(ctx *cli.Context, flag cli.StringFlag)

ParseBlockchainNetworkFlag parses a cli.StringFlag as a blockchain network from command's context and sets default values for network parameters and CLI values for the network to the application configuration.

func (*Config) ParseBoolFlag

func (cfg *Config) ParseBoolFlag(ctx *cli.Context, flag cli.BoolFlag)

ParseBoolFlag parses a cli.BoolFlag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseDurationFlag

func (cfg *Config) ParseDurationFlag(ctx *cli.Context, flag cli.DurationFlag)

ParseDurationFlag parses a cli.DurationFlag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseFloat64Flag

func (cfg *Config) ParseFloat64Flag(ctx *cli.Context, flag cli.Float64Flag)

ParseFloat64Flag parses a cli.Float64Flag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseInt64Flag

func (cfg *Config) ParseInt64Flag(ctx *cli.Context, flag cli.Int64Flag)

ParseInt64Flag parses a cli.Int64Flag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseIntFlag

func (cfg *Config) ParseIntFlag(ctx *cli.Context, flag cli.IntFlag)

ParseIntFlag parses a cli.IntFlag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseStringFlag

func (cfg *Config) ParseStringFlag(ctx *cli.Context, flag cli.StringFlag)

ParseStringFlag parses a cli.StringFlag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseStringSliceFlag

func (cfg *Config) ParseStringSliceFlag(ctx *cli.Context, flag cli.StringSliceFlag)

ParseStringSliceFlag parses a cli.StringSliceFlag from command's context and sets default and CLI values to the application configuration.

func (*Config) ParseUInt64Flag

func (cfg *Config) ParseUInt64Flag(ctx *cli.Context, flag cli.Uint64Flag)

ParseUInt64Flag parses a cli.Uint64Flag from command's context and sets default and CLI values to the application configuration.

func (*Config) RemoveCLI

func (cfg *Config) RemoveCLI(key string)

RemoveCLI removes configured CLI flag value by key.

func (*Config) RemoveUser

func (cfg *Config) RemoveUser(key string)

RemoveUser removes user configuration value for key.

func (*Config) SaveUserConfig

func (cfg *Config) SaveUserConfig() error

SaveUserConfig saves user configuration to the file from which it was loaded.

func (*Config) SetCLI

func (cfg *Config) SetCLI(key string, value interface{})

SetCLI sets value passed via CLI flag for key.

func (*Config) SetDefault

func (cfg *Config) SetDefault(key string, value interface{})

SetDefault sets default value for key.

func (*Config) SetDefaultsByNetwork

func (cfg *Config) SetDefaultsByNetwork(network BlockchainNetwork)

SetDefaultsByNetwork sets defaults in config according to the given blockchain network.

func (*Config) SetUser

func (cfg *Config) SetUser(key string, value interface{})

SetUser sets user configuration value for key.

Directories

Path Synopsis
urfavecli

Jump to

Keyboard shortcuts

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