config

package module
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 22 Imported by: 28

README

go-btfs-config

go-btfs configuration datastructure.

Documentation lives in the go-btfs repo: docs/config.md.

Table of Contents

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Bittorrent

Documentation

Overview

package config implements the ipfs config file datastructures and utilities.

Index

Constants

View Source
const (
	// DefaultPathName is the default config dir name
	DefaultPathName = ".btfs"
	// DefaultPathRoot is the path to the default config dir location.
	DefaultPathRoot = "~/" + DefaultPathName
	// DefaultConfigFile is the filename of the configuration file
	DefaultConfigFile = "config"
	// EnvDir is the environment variable used to change the path root.
	EnvDir = "BTFS_PATH"
)
View Source
const (
	ResourceMgrSystemScope         = "system"
	ResourceMgrTransientScope      = "transient"
	ResourceMgrServiceScopePrefix  = "svc:"
	ResourceMgrProtocolScopePrefix = "proto:"
	ResourceMgrPeerScopePrefix     = "peer:"
)
View Source
const DefaultConnMgrGracePeriod = time.Second * 10

DefaultConnMgrGracePeriod is the default value for the connection managers grace period

View Source
const DefaultConnMgrHighWater = 900

DefaultConnMgrHighWater is the default value for the connection managers 'high water' mark

View Source
const DefaultConnMgrLowWater = 10

DefaultConnMgrLowWater is the default value for the connection managers 'low water' mark

View Source
const DefaultConnMgrType = "basic"

DefaultConnMgrType is the default value for the connection managers type.

View Source
const DefaultDataStoreDirectory = "datastore"

DefaultDataStoreDirectory is the directory to store all the local IPFS data.

View Source
const DefaultEnableAutoRelay = true
View Source
const DefaultHostsSyncEnabled = false

DefaultHostSyncEnabled is the default value for the periodic hosts sync from hub

View Source
const DefaultHostsSyncMode = hubpb.HostsReq_SCORE

DefaultHostsSyncMode is the default value for the hosts sync mode from hub

View Source
const DefaultHostsSyncModeDev = hubpb.HostsReq_TESTNET
View Source
const DefaultInlineDNSLink = false
View Source
const DefaultReproviderInterval = time.Hour * 22 // https://github.com/ipfs/kubo/pull/9326
View Source
const DefaultReproviderStrategy = "all"
View Source
const DefaultSwarmKey = `/key/swarm/psk/1.0.0/
/base16/
64ef95289a6b998c776927ed6e33ca8c9202ee47df90141d09f5ffeeb64b8a66`

DefaultSwarmKey is the default swarm key for mainnet BTFS

View Source
const DefaultSwarmPort = 4001

DefaultSwarmPort is the default swarm discovery port

View Source
const DefaultTestnetSwarmKey = `/key/swarm/psk/1.0.0/
/base16/
d0566ce7e71d880487a89385296ab8a454967e975955ce0e59bff7991d5539d6`

DefaultTestnetSwarmKey is the default swarm key for testnet BTFS

View Source
const IdentityTag = "Identity"
View Source
const MnemonicSelector = IdentityTag + "." + MnemonicTag
View Source
const MnemonicTag = "Mnemonic"
View Source
const PrivKeySelector = IdentityTag + "." + PrivKeyTag
View Source
const PrivKeyTag = "PrivKey"

Variables

View Source
var DefaultBootstrapAddresses = []string{
	"/ip4/54.255.27.251/tcp/4001/p2p/QmURPwdLYesWUDB66EGXvDvwcyV44rVRqV2iGNqKN24eVu",
	"/ip4/13.213.254.73/tcp/4001/p2p/QmX7RZXh27AX8iv2BKLGMgPBiuUpEy8p4LFXgtXAfaZDn9",
	"/ip4/52.221.82.136/tcp/4001/p2p/QmYqCq3PasrzLr3PxtLo5D6spEAJ836W9Re9Eo4zUou45U",
	"/ip4/3.1.76.240/tcp/4001/p2p/16Uiu2HAmQfh6CYSWG1MM1DnzJ9duM8jxqn6vxNbjGBsmzc3kkctp",
	"/ip4/34.213.53.108/tcp/4001/p2p/QmWm3vBCRuZcJMUT9jDZysoYBb66aokmSReX26UaMk8qq5",
	"/ip4/35.161.203.220/tcp/4001/p2p/QmWJWGxKKaqZUW4xga2BCzT5FBtYDL8Cc5Q5jywd6xPt1g",
	"/ip4/35.84.213.199/tcp/4001/p2p/QmbVFdiNkvxtc7Nni7yBWAgtHg8MuyhaZ5mDaYR2ZrhhvN",
	"/ip4/35.84.151.38/tcp/4001/p2p/QmQVQBsM7uoJy8hATjTm51uSAkx2y3iGLhSwA6LWLa7iQJ",
	"/ip4/3.66.57.90/tcp/4001/p2p/16Uiu2HAmFT6NXQkzDZXHxuFC4qFt6D1ALf57AkJV9U54HoafX7FX",
	"/ip4/3.69.104.217/tcp/4001/p2p/16Uiu2HAm2v2NBTLYmzVnLJoNbLCmdn29Gv8qLixHCJNeE81rUUYe",
	"/ip4/3.126.224.22/tcp/4001/p2p/16Uiu2HAmNngtNogFpcAUdc6wdSDmb8ZZQjjoDDWaatBXW1rHsYpu",
	"/ip4/35.158.193.90/tcp/4001/p2p/16Uiu2HAmLY4kyhMuoBntyXSt2YssZCHjefHEAXrYVc6acB7KEBh3",
	"/ip4/13.232.5.9/tcp/4001/p2p/16Uiu2HAmSkFDwHU3snrYD2ib5wWeKcsuFMZWEPt31z5YVJ8ktw1p",
	"/ip4/3.7.220.224/tcp/4001/p2p/16Uiu2HAmRVtFaXksAqb8W4Fyr8g5jkggeGDFdVcp8dQ724NMvpcR",
	"/ip4/3.109.125.91/tcp/4001/p2p/16Uiu2HAkzggX1jKwc1xen5qNPQ5RKNkXQqmH2PYAKGd8JZ15YQmK",
	"/ip4/65.1.217.86/tcp/4001/p2p/16Uiu2HAmGwDdvK4jAi1Ahga3zkiuW6HFZKKFNWtqVUFXvaSCNjdg",
	"/ip4/15.184.66.135/tcp/4001/p2p/16Uiu2HAmBQcXzrgo9MVD8xZwt4CrLzPRK1yKAVM7eY9GhXMJYHmC",
	"/ip4/15.184.174.48/tcp/4001/p2p/16Uiu2HAm6Bkxj81JQxa67aja7UWznjTgzAAVzPAqZMVD6oGpw7ST",
	"/ip4/15.184.108.65/tcp/4001/p2p/16Uiu2HAkzRyGYEba2B3SBXdwp328LNFhRG4qhJVZrN6tsJK5KKu5",
	"/ip4/15.184.96.102/tcp/4001/p2p/16Uiu2HAmFVWTvouWpQTRjMb4bUaidfLzsH2RVogcGHb6RwvPSxuT",
	"/ip4/16.24.14.84/tcp/4001/p2p/16Uiu2HAmM96uUH53Ab9JBWfuwUBXJvGMbfVbsBXiGZGqStP93DTS",
	"/ip4/16.24.16.4/tcp/4001/p2p/16Uiu2HAmJ6vEtzmmC6nM6SJwHA9NCPwTRWy7K5WT2UFXDqzJFGSf",
	"/ip4/3.76.64.148/tcp/4001/p2p/16Uiu2HAmFc3snGkwK76yMYMAkHWhq6GD29w7m8Sa7kUciUK5xovu",
	"/ip4/3.78.178.244/tcp/4001/p2p/16Uiu2HAmHeUHakzYG1YWfWoSriVwKhSHYz88rL3USmgeRpqtWqMw",
	"/ip4/3.7.21.138/tcp/4001/p2p/16Uiu2HAm7QD77kxSKf1GTM3YkrYp8vkhUwS2ySJPht9jALeaHaft",
	"/ip4/43.204.199.237/tcp/4001/p2p/16Uiu2HAm3tpaz9zgqB4i2FEwX7dwTJzv88Krpdy3kRecXZos3WdM",
	"/ip4/35.155.192.241/tcp/4001/p2p/16Uiu2HAm29iAxcKRPNRBVMYCz455uck5o7KmdPJ9GQ5BKvpxxca9",
	"/ip4/35.83.203.96/tcp/4001/p2p/16Uiu2HAmNnKCdkBKdoPo4sXSLhDgXvPmCi7NCjo8cfcP5RRb4mKL",
	"/ip4/54.69.57.58/tcp/4001/p2p/16Uiu2HAmNDZWZtyRNZMLQ88933SFcVp2gtb99aQVbADXcCFcjFn9",
	"/ip4/35.164.151.55/tcp/4001/p2p/16Uiu2HAmMgufksaU9aaenq2bNtGnG5QokCS1xdzJwUS6yRtakhbs",
}

DefaultBootstrapAddresses are the hardcoded bootstrap addresses for IPFS. they are nodes run by the IPFS team. docs on these later. As with all p2p networks, bootstrap is an important security concern.

NOTE: This is here -- and not inside cmd/btfs/init.go -- because of an import dependency issue. TODO: move this into a config/default/ package.

View Source
var DefaultTestnetBootstrapAddresses = []string{
	"/ip4/18.224.174.215/tcp/45301/p2p/16Uiu2HAmFFwNdgSoLhfgJUPEfPEVodppRxaeZBVpAvrH5s3qSkWo",
	"/ip4/18.224.174.215/tcp/34237/p2p/16Uiu2HAmDigS3SDx6g9Sp6MUfdFHvDwS8Zw8E14V6bLhCAHA3jjB",
	"/ip4/18.224.174.215/tcp/43097/p2p/16Uiu2HAm7HQoEbQe1fYt4LtnG6z5TqwTrrqUv5xsnt4nukskWmAi",
	"/ip4/18.224.174.215/tcp/38955/p2p/16Uiu2HAm5WrYvkJwaRP7ZAroWCfjaUxKkNssqcSmEmKJ8vXVYp1o",
	"/ip4/54.151.185.243/tcp/36707/p2p/16Uiu2HAmDis3wAorW46YyNmXNk963VAAHwZ1phjHXj5yduyawAUy",
	"/ip4/54.151.185.243/tcp/42741/p2p/16Uiu2HAmSfqLCyqH5qQQF8zpzPMQvWiQunhWpYtSxwGw5QR2jhgU",
	"/ip4/54.151.185.243/tcp/37403/p2p/16Uiu2HAmBHwyRUETsGqjYpgPRpnMC9y39tcVYH6vKxZidCBcBeFG",
	"/ip4/54.151.185.243/tcp/37739/p2p/16Uiu2HAm2oKy37KvYmiv1nnRWZwUoLPZumNKFxPzhM1t8F3KxADu",
	"/ip4/18.158.67.141/tcp/40155/p2p/16Uiu2HAmTMEqndByECXuxk1Rg8szxMqwS3tUFFWhAUduFzwfwmfK",
	"/ip4/18.158.67.141/tcp/44569/p2p/16Uiu2HAmL4QNi68nSNbedUWp1A1cRR3z3NuJqQYmAYoj19ht6iNv",
	"/ip4/18.158.67.141/tcp/39703/p2p/16Uiu2HAkzF6JMx4EL2C4cLoCLyQH8t1sgyttQxPfQtNt5FZhvpxs",
	"/ip4/18.158.67.141/tcp/46713/p2p/16Uiu2HAm85HXJA7xmgNxxTVdFRuRCGstvrY8nW6KqfTtkuZrZg64",
	"/ip4/18.163.235.175/tcp/36335/p2p/16Uiu2HAm8wVUsVsqksBfxy6yzHpVv5gELQnpU7Q2uhDyXFwr9bfV",
	"/ip4/18.163.235.175/tcp/44029/p2p/16Uiu2HAmBvnQU5FWgEcfY1jaAK2Q9iQBy6FwQdDUtyT7mo8HU1Yu",
	"/ip4/18.163.235.175/tcp/40191/p2p/16Uiu2HAkurshicwtTrqbrL3yv9xR7hogPvreUHJP3W8n9W5XMibz",
}
View Source
var ErrInvalidPeerAddr = errors.New("invalid peer address")

ErrInvalidPeerAddr signals an address is not a valid peer address.

View Source
var Profiles = map[string]Profile{
	"server": {
		Description: `Disables local host discovery, recommended when
running IPFS on machines with public IPv4 addresses.`,

		Transform: func(c *Config) error {
			c.Addresses.NoAnnounce = appendSingle(c.Addresses.NoAnnounce, defaultServerFilters)
			c.Swarm.AddrFilters = appendSingle(c.Swarm.AddrFilters, defaultServerFilters)
			c.Discovery.MDNS.Enabled = false
			c.Swarm.DisableNatPortMap = true
			return nil
		},
	},

	"local-discovery": {
		Description: `Sets default values to fields affected by the server
profile, enables discovery in local networks.`,

		Transform: func(c *Config) error {
			c.Addresses.NoAnnounce = deleteEntries(c.Addresses.NoAnnounce, defaultServerFilters)
			c.Swarm.AddrFilters = deleteEntries(c.Swarm.AddrFilters, defaultServerFilters)
			c.Discovery.MDNS.Enabled = true
			c.Swarm.DisableNatPortMap = false
			return nil
		},
	},
	"test": {
		Description: `Reduces external interference of IPFS daemon, this
is useful when using the daemon in test environments.`,

		Transform: func(c *Config) error {
			c.Addresses.API = Strings{"/ip4/127.0.0.1/tcp/0"}
			c.Addresses.Gateway = Strings{"/ip4/127.0.0.1/tcp/0"}
			c.Addresses.Swarm = []string{
				"/ip4/127.0.0.1/tcp/0",
			}

			c.Swarm.DisableNatPortMap = true

			c.Bootstrap = []string{}
			c.Discovery.MDNS.Enabled = false
			return nil
		},
	},
	"default-networking": {
		Description: `Restores default network settings.
Inverse profile of the test profile.`,

		Transform: func(c *Config) error {
			c.Addresses = addressesConfig()

			bootstrapPeers, err := DefaultBootstrapPeers()
			if err != nil {
				return err
			}
			c.Bootstrap = appendSingle(c.Bootstrap, BootstrapPeerStrings(bootstrapPeers))

			c.Swarm.DisableNatPortMap = false
			c.Discovery.MDNS.Enabled = true
			return nil
		},
	},
	"announce-public": {
		Description: `Announce public IP when running on cloud VM or local network.`,
		Transform: func(c *Config) error {
			address, err := ExternalIP()
			if err != nil {
				return err
			}
			c.Addresses.Announce = appendSingle(c.Addresses.Announce, []string{address})
			return nil
		},
	},
	"default-datastore": {
		Description: `Configures the node to use the default datastore (flatfs).

Read the "flatfs" profile description for more information on this datastore.

This profile may only be applied when first initializing the node.
`,

		InitOnly: true,
		Transform: func(c *Config) error {
			c.Datastore.Spec = flatfsSpec()
			return nil
		},
	},
	"flatfs": {
		Description: `Configures the node to use the flatfs datastore.

This is the most battle-tested and reliable datastore, but it's significantly
slower than the badger datastore. You should use this datastore if:

* You need a very simple and very reliable datastore you and trust your
  filesystem. This datastore stores each block as a separate file in the
  underlying filesystem so it's unlikely to loose data unless there's an issue
  with the underlying file system.
* You need to run garbage collection on a small (<= 10GiB) datastore. The
  default datastore, badger, can leave several gigabytes of data behind when
  garbage collecting.
* You're concerned about memory usage. In its default configuration, badger can
  use up to several gigabytes of memory.

This profile may only be applied when first initializing the node.
`,

		InitOnly: true,
		Transform: func(c *Config) error {
			c.Datastore.Spec = flatfsSpec()
			return nil
		},
	},
	"badgerds": {
		Description: `Configures the node to use the badger datastore.

This is the fastest datastore. Use this datastore if performance, especially
when adding many gigabytes of files, is critical. However:

* This datastore will not properly reclaim space when your datastore is
  smaller than several gigabytes. If you run IPFS with '--enable-gc' (you have
  enabled block-level garbage collection), you plan on storing very little data in
  your IPFS node, and disk usage is more critical than performance, consider using
  flatfs.
* This datastore uses up to several gigabytes of memory. 

This profile may only be applied when first initializing the node.`,

		InitOnly: true,
		Transform: func(c *Config) error {
			c.Datastore.Spec = badgerSpec()
			return nil
		},
	},
	"lowpower": {
		Description: `Reduces daemon overhead on the system. May affect node
functionality - performance of content discovery and data
fetching may be degraded.
`,
		Transform: func(c *Config) error {
			c.Routing.Type = NewOptionalString("dhtclient")
			c.AutoNAT.ServiceMode = AutoNATServiceDisabled
			c.Reprovider.Interval = NewOptionalDuration(0)

			lowWater := int64(20)
			highWater := int64(40)
			gracePeriod := time.Minute
			c.Swarm.ConnMgr.Type = NewOptionalString("basic")
			c.Swarm.ConnMgr.LowWater = &OptionalInteger{value: &lowWater}
			c.Swarm.ConnMgr.HighWater = &OptionalInteger{value: &highWater}
			c.Swarm.ConnMgr.GracePeriod = &OptionalDuration{&gracePeriod}
			return nil
		},
	},
	"randomports": {
		Description: `Use a random port number for swarm.`,

		Transform: func(c *Config) error {
			port, err := getAvailablePort()
			if err != nil {
				return err
			}
			c.Addresses.Swarm = []string{
				fmt.Sprintf("/ip4/0.0.0.0/tcp/%d", port),
				fmt.Sprintf("/ip6/::/tcp/%d", port),
			}
			return nil
		},
	},
	"storage-host": {
		Description: `Configures necessary flags and options for node to become a storage host.`,

		Transform: func(c *Config) error {
			bootstrapPeers, err := DefaultBootstrapPeers()
			if err != nil {
				return err
			}
			c.Bootstrap = BootstrapPeerStrings(bootstrapPeers)
			c.Experimental.Libp2pStreamMounting = true
			c.Experimental.StorageHostEnabled = true
			c.Experimental.Analytics = true
			c.Experimental.ReportOnline = true
			c.Experimental.ReportStatusContract = true
			if len(c.Addresses.RemoteAPI) == 0 {
				c.Addresses.RemoteAPI = Strings{"/ip4/0.0.0.0/tcp/5101"}
			}
			if c.Datastore.StorageMax == "10GB" {
				c.Datastore.StorageMax = "1TB"
			}
			c.Services = DefaultServicesConfig()
			c.Swarm.SwarmKey = DefaultSwarmKey
			c.ChainInfo = ChainInfo{
				ChainId: bttcChainID,
			}
			return nil
		},
	},
	"storage-host-dev": {
		Description: `[dev] Configures necessary flags and options for node to become a storage host.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageHost(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigDev()
			return nil
		},
	},
	"storage-host-testnet": {
		Description: `[testnet] Configures necessary flags and options for node to become a storage host.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageHost(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigTestnet()
			return nil
		},
	},
	"storage-repairer": {
		Description: `Configures necessary flags and options for node to become a storage repairer.`,

		Transform: func(c *Config) error {
			bootstrapPeers, err := DefaultBootstrapPeers()
			if err != nil {
				return err
			}
			c.Bootstrap = BootstrapPeerStrings(bootstrapPeers)
			c.Experimental.Libp2pStreamMounting = true
			c.Experimental.HostRepairEnabled = true
			c.Experimental.Analytics = true
			if len(c.Addresses.RemoteAPI) == 0 {
				c.Addresses.RemoteAPI = Strings{"/ip4/0.0.0.0/tcp/5101"}
			}
			c.Services = DefaultServicesConfig()
			c.Swarm.SwarmKey = DefaultSwarmKey
			return nil
		},
	},
	"storage-repairer-dev": {
		Description: `[dev] Configures necessary flags and options for node to become a storage repairer.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageRepairer(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigDev()
			return nil
		},
	},
	"storage-repairer-testnet": {
		Description: `[testnet] Configures necessary flags and options for node to become a storage repairer.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageRepairer(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigTestnet()
			return nil
		},
	},
	"storage-client": {
		Description: `Configures necessary flags and options for node to pay to store files on the network.`,

		Transform: func(c *Config) error {
			bootstrapPeers, err := DefaultBootstrapPeers()
			if err != nil {
				return err
			}
			c.Bootstrap = BootstrapPeerStrings(bootstrapPeers)
			c.Experimental.Libp2pStreamMounting = true
			c.Experimental.StorageClientEnabled = true
			c.Experimental.StorageHostEnabled = false
			c.Experimental.HostsSyncEnabled = true
			c.Experimental.HostsSyncMode = DefaultHostsSyncMode.String()
			if len(c.Addresses.RemoteAPI) == 0 {
				c.Addresses.RemoteAPI = Strings{"/ip4/0.0.0.0/tcp/5101"}
			}
			c.Services = DefaultServicesConfig()
			c.Swarm.SwarmKey = DefaultSwarmKey
			return nil
		},
	},
	"storage-client-dev": {
		Description: `[dev] Configures necessary flags and options for node to pay to store files on the network.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageClient(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigDev()
			return nil
		},
	},
	"storage-client-testnet": {
		Description: `[testnet] Configures necessary flags and options for node to pay to store files on the network.`,

		Transform: func(c *Config) error {
			if err := transformDevStorageClient(c); err != nil {
				return err
			}
			c.Services = DefaultServicesConfigTestnet()
			return nil
		},
	},
}

Profiles is a map holding configuration transformers. Docs are in docs/config.md

Functions

func BootstrapPeerStrings

func BootstrapPeerStrings(bps []peer.AddrInfo) []string

BootstrapPeerStrings formats a list of AddrInfos as a bootstrap peer list suitable for serialization.

func DataStorePath

func DataStorePath(configroot string) (string, error)

DataStorePath returns the default data store path given a configuration root (set an empty string to have the default configuration root)

func DefaultBootstrapPeers

func DefaultBootstrapPeers() ([]peer.AddrInfo, error)

DefaultBootstrapPeers returns the (parsed) set of default bootstrap peers. if it fails, it returns a meaningful error for the user. This is here (and not inside cmd/btfs/init) because of module dependency problems.

func DefaultTestnetBootstrapPeers

func DefaultTestnetBootstrapPeers() ([]peer.AddrInfo, error)

func ExternalIP

func ExternalIP() (string, error)

func ExternalIPWithPort

func ExternalIPWithPort(extPort, intPort int, swarmAddrs []string) (string, error)

func Filename

func Filename(configroot string) (string, error)

Filename returns the configuration file path given a configuration root directory. If the configuration root directory is empty, use the default one

func GetAddrOfConst

func GetAddrOfConst(i int) *int64

func HumanOutput

func HumanOutput(value interface{}) ([]byte, error)

HumanOutput gets a config value ready for printing

func Marshal

func Marshal(value interface{}) ([]byte, error)

Marshal configuration with JSON

func MigrateConfig

func MigrateConfig(cfg *Config, inited, hasHval bool) bool

MigrateConfig migrates config options to the latest known version It may correct incompatible configs as well inited = just initialized in the same call hasHval = passed in Hval in the same call

func ParseBootstrapPeers

func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error)

ParseBootstrapPeer parses a bootstrap list into a list of AddrInfos.

func Path

func Path(configroot, extension string) (string, error)

Path returns the path `extension` relative to the configuration root. If an empty string is provided for `configroot`, the default root is used.

func PathRoot

func PathRoot() (string, error)

PathRoot returns the default configuration root directory

func ToMap

func ToMap(conf *Config) (map[string]interface{}, error)

Types

type API

type API struct {
	HTTPHeaders map[string][]string // HTTP headers to return with the API.
}

type Addresses

type Addresses struct {
	Swarm      []string // addresses for the swarm to listen on
	Announce   []string // swarm addresses to announce to the network
	NoAnnounce []string // swarm addresses not to announce to the network
	API        Strings  // address for the local API (RPC)
	Gateway    Strings  // address to listen on for BTFS HTTP object gateway
	RemoteAPI  Strings  // address to listen for remote API (RPC over libp2p)
}

Addresses stores the (string) multiaddr addresses for the node.

type AutoNATConfig

type AutoNATConfig struct {
	// ServiceMode configures the node's AutoNAT service mode.
	ServiceMode AutoNATServiceMode `json:",omitempty"`

	// Throttle configures AutoNAT dialback throttling.
	//
	// If unset, the conservative libp2p defaults will be unset. To help the
	// network, please consider setting this and increasing the limits.
	//
	// By default, the limits will be a total of 30 dialbacks, with a
	// per-peer max of 3 peer, resetting every minute.
	Throttle *AutoNATThrottleConfig `json:",omitempty"`
}

AutoNATConfig configures the node's AutoNAT subsystem.

type AutoNATServiceMode

type AutoNATServiceMode int

AutoNATServiceMode configures the ipfs node's AutoNAT service.

const (
	// AutoNATServiceUnset indicates that the user has not set the
	// AutoNATService mode.
	//
	// When unset, nodes configured to be public DHT nodes will _also_
	// perform limited AutoNAT dialbacks.
	AutoNATServiceUnset AutoNATServiceMode = iota
	// AutoNATServiceEnabled indicates that the user has enabled the
	// AutoNATService.
	AutoNATServiceEnabled
	// AutoNATServiceDisabled indicates that the user has disabled the
	// AutoNATService.
	AutoNATServiceDisabled
)

func (AutoNATServiceMode) MarshalText

func (m AutoNATServiceMode) MarshalText() ([]byte, error)

func (*AutoNATServiceMode) UnmarshalText

func (m *AutoNATServiceMode) UnmarshalText(text []byte) error

type AutoNATThrottleConfig

type AutoNATThrottleConfig struct {
	// GlobalLimit and PeerLimit sets the global and per-peer dialback
	// limits. The AutoNAT service will only perform the specified number of
	// dialbacks per interval.
	//
	// Setting either to 0 will disable the appropriate limit.
	GlobalLimit, PeerLimit int

	// Interval specifies how frequently this node should reset the
	// global/peer dialback limits.
	//
	// When unset, this defaults to 1 minute.
	Interval OptionalDuration `json:",omitempty"`
}

AutoNATThrottleConfig configures the throttle limites

type ChainInfo

type ChainInfo struct {
	ChainId            int64  `json:",omitempty"`
	CurrentFactory     string `json:",omitempty"`
	PriceOracleAddress string `json:",omitempty"`
	VaultLogicAddress  string `json:",omitempty"`
	Endpoint           string `json:",omitempty"`
}

the configuration of the local node's ChainInfo.

type ComposableRouterParams

type ComposableRouterParams struct {
	Routers []ConfigRouter
	Timeout *OptionalDuration `json:",omitempty"`
}

type Config

type Config struct {
	ChainInfo ChainInfo // local node's chain info
	Identity  Identity  // local node's peer identity
	Datastore Datastore // local node's storage
	Addresses Addresses // local node's addresses
	Mounts    Mounts    // local node's mount points
	Discovery Discovery // local node's discovery mechanisms
	Routing   Routing   // local node's routing settings
	Ipns      Ipns      // Ipns settings
	Bootstrap []string  // local nodes's bootstrap peer addresses
	Gateway   Gateway   // local node's gateway server options
	API       API       // local node's API settings
	Swarm     SwarmConfig
	AutoNAT   AutoNATConfig
	Pubsub    PubsubConfig
	Peering   Peering
	DNS       DNS
	Services  Services // External service domains and info

	Provider     Provider
	Reprovider   Reprovider
	Experimental Experiments
	UI           UI
	Plugins      Plugins

	Internal Internal // experimental/unstable options

	SimpleMode bool
}

Config is used to load ipfs config files.

func FromMap

func FromMap(v map[string]interface{}) (*Config, error)

func Init

func Init(out io.Writer, nBitsForKeypair int, keyType string, importKey string, mnemonic string, rmOnUnpin bool) (*Config, error)

func (*Config) BootstrapPeers

func (c *Config) BootstrapPeers() ([]peer.AddrInfo, error)

func (*Config) Clone

func (c *Config) Clone() (*Config, error)

Clone copies the config. Use when updating.

func (*Config) SetBootstrapPeers

func (c *Config) SetBootstrapPeers(bps []peer.AddrInfo)

type ConfigRouter

type ConfigRouter struct {
	RouterName   string
	Timeout      Duration
	IgnoreErrors bool
	ExecuteAfter *OptionalDuration `json:",omitempty"`
}

type ConnMgr

type ConnMgr struct {
	Type        *OptionalString   `json:",omitempty"`
	LowWater    *OptionalInteger  `json:",omitempty"`
	HighWater   *OptionalInteger  `json:",omitempty"`
	GracePeriod *OptionalDuration `json:",omitempty"`
}

ConnMgr defines configuration options for the libp2p connection manager

type ContractManager

type ContractManager struct {
	LowWater  int
	HighWater int
	Threshold int64
}

type DHTMode

type DHTMode string
const (
	DHTModeServer DHTMode = "server"
	DHTModeClient DHTMode = "client"
	DHTModeAuto   DHTMode = "auto"
)

type DHTRouterParams

type DHTRouterParams struct {
	Mode                 DHTMode
	AcceleratedDHTClient bool `json:",omitempty"`
	PublicIPNetwork      bool
}

type DNS

type DNS struct {
	// Resolvers is a map of FQDNs to URLs for custom DNS resolution.
	// URLs starting with `https://` indicate DoH endpoints.
	// Support for other resolver types can be added in the future.
	// https://en.wikipedia.org/wiki/Fully_qualified_domain_name
	// https://en.wikipedia.org/wiki/DNS_over_HTTPS
	//
	// Example:
	// - Custom resolver for ENS:          `eth.` → `https://dns.eth.limo/dns-query`
	// - Override the default OS resolver: `.`    → `https://doh.applied-privacy.net/query`
	Resolvers map[string]string
	// MaxCacheTTL is the maximum duration DNS entries are valid in the cache.
	MaxCacheTTL *OptionalDuration `json:",omitempty"`
}

DNS specifies DNS resolution rules using custom resolvers

type Datastore

type Datastore struct {
	StorageMax         string // in B, kB, kiB, MB, ...
	StorageGCWatermark int64  // in percentage to multiply on StorageMax
	GCPeriod           string // in ns, us, ms, s, m, h

	// deprecated fields, use Spec
	Type   string           `json:",omitempty"`
	Path   string           `json:",omitempty"`
	NoSync bool             `json:",omitempty"`
	Params *json.RawMessage `json:",omitempty"`

	Spec map[string]interface{}

	HashOnRead      bool
	BloomFilterSize int
}

Datastore tracks the configuration of the datastore.

func DefaultDatastoreConfig

func DefaultDatastoreConfig() Datastore

DefaultDatastoreConfig is an internal function exported to aid in testing.

type Discovery

type Discovery struct {
	MDNS MDNS
}

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Experiments

type Experiments struct {
	FilestoreEnabled     bool
	UrlstoreEnabled      bool
	ShardingEnabled      bool
	GraphsyncEnabled     bool
	Libp2pStreamMounting bool
	P2pHttpProxy         bool
	StrategicProviding   bool
	StorageHostEnabled   bool
	StorageClientEnabled bool
	Analytics            bool
	RemoveOnUnpin        bool
	HostsSyncEnabled     bool
	HostsSyncFlag        bool
	HostsSyncMode        string
	DisableAutoUpdate    bool
	HostRepairEnabled    bool
	HostChallengeEnabled bool
	ReportOnline         bool
	ReportStatusContract bool
	AcceleratedDHTClient bool
}

type Flag

type Flag int8

Flag represents a ternary value: false (-1), default (0), or true (+1).

When encoded in json, False is "false", Default is "null" (or empty), and True is "true".

const (
	False   Flag = -1
	Default Flag = 0
	True    Flag = 1
)

func (Flag) MarshalJSON

func (f Flag) MarshalJSON() ([]byte, error)

func (Flag) String

func (f Flag) String() string

func (*Flag) UnmarshalJSON

func (f *Flag) UnmarshalJSON(input []byte) error

func (Flag) WithDefault

func (f Flag) WithDefault(defaultValue bool) bool

WithDefault resolves the value of the flag given the provided default value.

Panics if Flag is an invalid value.

type Gateway

type Gateway struct {

	// HTTPHeaders configures the headers that should be returned by this
	// gateway.
	HTTPHeaders map[string][]string // HTTP headers to return with the gateway

	// RootRedirect is the path to which requests to `/` on this gateway
	// should be redirected.
	RootRedirect string

	// REMOVED: modern replacement tracked in https://github.com/ipfs/specs/issues/375
	Writable bool

	// PathPrefixes was removed: https://github.com/ipfs/go-ipfs/issues/7702
	PathPrefixes []string

	// FIXME: Not yet implemented: https://github.com/ipfs/kubo/issues/8059
	APICommands []string

	// NoFetch configures the gateway to _not_ fetch blocks in response to
	// requests.
	NoFetch bool

	// NoDNSLink configures the gateway to _not_ perform DNS TXT record
	// lookups in response to requests with values in `Host` HTTP header.
	// This flag can be overridden per FQDN in PublicGateways.
	NoDNSLink bool

	// PublicGateways configures behavior of known public gateways.
	// Each key is a fully qualified domain name (FQDN).
	PublicGateways map[string]*GatewaySpec
}

Gateway contains options for the HTTP gateway server.

type GatewaySpec

type GatewaySpec struct {
	// Paths is explicit list of path prefixes that should be handled by
	// this gateway. Example: `["/ipfs", "/ipns", "/api"]`
	Paths []string

	// UseSubdomains indicates whether or not this gateway uses subdomains
	// for IPFS resources instead of paths. That is: http://CID.ipfs.GATEWAY/...
	//
	// If this flag is set, any /ipns/$id and/or /ipfs/$id paths in Paths
	// will be permanently redirected to http://$id.[ipns|ipfs].$gateway/.
	//
	// We do not support using both paths and subdomains for a single domain
	// for security reasons (Origin isolation).
	UseSubdomains bool

	// NoDNSLink configures this gateway to _not_ resolve DNSLink for the FQDN
	// provided in `Host` HTTP header.
	NoDNSLink bool

	// InlineDNSLink configures this gateway to always inline DNSLink names
	// (FQDN) into a single DNS label in order to interop with wildcard TLS certs
	// and Origin per CID isolation provided by rules like https://publicsuffix.org
	InlineDNSLink Flag
}

type HTTPRouterParams

type HTTPRouterParams struct {
	// Endpoint is the URL where the routing implementation will point to get the information.
	Endpoint string

	// MaxProvideBatchSize determines the maximum amount of CIDs sent per batch.
	// Servers might not accept more than 100 elements per batch. 100 elements by default.
	MaxProvideBatchSize int

	// MaxProvideConcurrency determines the number of threads used when providing content. GOMAXPROCS by default.
	MaxProvideConcurrency int
}

func (*HTTPRouterParams) FillDefaults

func (hrp *HTTPRouterParams) FillDefaults()

type HostUI

type HostUI struct {
	Initialized     bool
	ContractManager *ContractManager
}

type Identity

type Identity struct {
	PeerID            string
	PrivKey           string `json:",omitempty"`
	HexPrivKey        string `json:",omitempty"`
	BttcAddr          string `json:",omitempty"`
	Mnemonic          string `json:",omitempty"`
	EncryptedMnemonic string `json:",omitempty"`
	EncryptedPrivKey  string `json:",omitempty"`
}

Identity tracks the configuration of the local node's identity.

func IdentityConfig

func IdentityConfig(out io.Writer, nbits int, keyType string, importKey string, mnemonic string) (Identity, error)

IdentityConfig initializes a new identity.

func (*Identity) DecodePrivateKey

func (i *Identity) DecodePrivateKey(passphrase string) (ic.PrivKey, error)

DecodePrivateKey is a helper to decode the users PrivateKey

type Internal

type Internal struct {
	// All marked as omitempty since we are expecting to make changes to all subcomponents of Internal
	Bitswap                     *InternalBitswap `json:",omitempty"`
	UnixFSShardingSizeThreshold *OptionalString  `json:",omitempty"`
	Libp2pForceReachability     *OptionalString  `json:",omitempty"`
}

type InternalBitswap

type InternalBitswap struct {
	TaskWorkerCount             OptionalInteger
	EngineBlockstoreWorkerCount OptionalInteger
	EngineTaskWorkerCount       OptionalInteger
	MaxOutstandingBytesPerPeer  OptionalInteger
	ProviderSearchDelay         OptionalDuration
}

type Ipns

type Ipns struct {
	RepublishPeriod string
	RecordLifetime  string

	ResolveCacheSize int
}

type MDNS

type MDNS struct {
	Enabled bool

	// Time in seconds between discovery rounds
	Interval int
}

type Method

type Method struct {
	RouterName string
}

type MethodName

type MethodName string
const (
	MethodNameProvide       MethodName = "provide"
	MethodNameFindProviders MethodName = "find-providers"
	MethodNameFindPeers     MethodName = "find-peers"
	MethodNameGetIPNS       MethodName = "get-ipns"
	MethodNamePutIPNS       MethodName = "put-ipns"
)

type Methods

type Methods map[MethodName]Method

func (Methods) Check

func (m Methods) Check() error

type Mounts

type Mounts struct {
	IPFS           string `json:"IPFS,omitempty"`
	IPNS           string `json:"IPNS,omitempty"`
	FuseAllowOther bool

	BTFS string
	BTNS string
}

Mounts stores the (string) mount points

type OptionalDuration

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

OptionalDuration wraps time.Duration to provide json serialization and deserialization.

NOTE: the zero value encodes to JSON nill

func NewOptionalDuration

func NewOptionalDuration(d time.Duration) *OptionalDuration

NewOptionalDuration returns an OptionalDuration from a string

func (*OptionalDuration) IsDefault

func (d *OptionalDuration) IsDefault() bool

func (OptionalDuration) MarshalJSON

func (d OptionalDuration) MarshalJSON() ([]byte, error)

func (OptionalDuration) String

func (d OptionalDuration) String() string

func (*OptionalDuration) UnmarshalJSON

func (d *OptionalDuration) UnmarshalJSON(input []byte) error

func (*OptionalDuration) WithDefault

func (d *OptionalDuration) WithDefault(defaultValue time.Duration) time.Duration

type OptionalInteger

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

OptionalInteger represents an integer that has a default value

When encoded in json, Default is encoded as "null"

func (*OptionalInteger) IsDefault

func (p *OptionalInteger) IsDefault() bool

IsDefault returns if this is a default optional integer

func (OptionalInteger) MarshalJSON

func (p OptionalInteger) MarshalJSON() ([]byte, error)

func (OptionalInteger) String

func (p OptionalInteger) String() string

func (*OptionalInteger) UnmarshalJSON

func (p *OptionalInteger) UnmarshalJSON(input []byte) error

func (*OptionalInteger) WithDefault

func (p *OptionalInteger) WithDefault(defaultValue int64) (value int64)

WithDefault resolves the integer with the given default.

type OptionalString

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

OptionalString represents a string that has a default value

When encoded in json, Default is encoded as "null"

func NewOptionalString

func NewOptionalString(s string) *OptionalString

NewOptionalString returns an OptionalString from a string

func (*OptionalString) IsDefault

func (p *OptionalString) IsDefault() bool

IsDefault returns if this is a default optional integer

func (OptionalString) MarshalJSON

func (p OptionalString) MarshalJSON() ([]byte, error)

func (OptionalString) String

func (p OptionalString) String() string

func (*OptionalString) UnmarshalJSON

func (p *OptionalString) UnmarshalJSON(input []byte) error

func (*OptionalString) WithDefault

func (p *OptionalString) WithDefault(defaultValue string) (value string)

WithDefault resolves the integer with the given default.

type Peering

type Peering struct {
	// Peers lists the nodes to attempt to stay connected with.
	Peers []peer.AddrInfo
}

Peering configures the peering service.

type Plugin

type Plugin struct {
	Disabled bool
	Config   interface{}
}

type Plugins

type Plugins struct {
	Plugins map[string]Plugin
}

type Priority

type Priority int64

Priority represents a value with a priority where 0 means "default" and -1 means "disabled".

When encoded in json, Default is encoded as "null" and Disabled is encoded as "false".

const (
	DefaultPriority Priority = 0
	Disabled        Priority = -1
)

func (Priority) MarshalJSON

func (p Priority) MarshalJSON() ([]byte, error)

func (Priority) String

func (p Priority) String() string

func (*Priority) UnmarshalJSON

func (p *Priority) UnmarshalJSON(input []byte) error

func (Priority) WithDefault

func (p Priority) WithDefault(defaultPriority Priority) (priority int64, enabled bool)

WithDefault resolves the priority with the given default.

If defaultPriority is Default/0, this function will return 0.

Panics if the priority has an invalid value (e.g., not DefaultPriority, Disabled, or > 0).

type Profile

type Profile struct {
	// Description briefly describes the functionality of the profile.
	Description string

	// Transform takes ipfs configuration and applies the profile to it.
	Transform Transformer

	// InitOnly specifies that this profile can only be applied on init.
	InitOnly bool
}

Profile contains the profile transformer the description of the profile

type Provider

type Provider struct {
	Strategy string // Which keys to announce
}

type PubsubConfig

type PubsubConfig struct {
	// Router can be either floodsub (legacy) or gossipsub (new and
	// backwards compatible).
	Router string

	// DisableSigning disables message signing. Message signing is *enabled*
	// by default.
	DisableSigning bool
}

type ReframeRouterParams

type ReframeRouterParams struct {
	// Endpoint is the URL where the routing implementation will point to get the information.
	// Usually used for reframe Routers.
	Endpoint string
}

type RelayClient

type RelayClient struct {
	// Enables the auto relay feature: will use relays if it is not publicly reachable.
	Enabled Flag `json:",omitempty"`

	// StaticRelays configures static relays to use when this node is not
	// publicly reachable. If set, auto relay will not try to find any
	// other relay servers.
	StaticRelays []string `json:",omitempty"`
}

type RelayService

type RelayService struct {
	// Enables the limited relay service for other peers (circuit v2 relay).
	Enabled Flag `json:",omitempty"`

	// ConnectionDurationLimit is the time limit before resetting a relayed connection.
	ConnectionDurationLimit *OptionalDuration `json:",omitempty"`
	// ConnectionDataLimit is the limit of data relayed (on each direction) before resetting the connection.
	ConnectionDataLimit *OptionalInteger `json:",omitempty"`

	// ReservationTTL is the duration of a new (or refreshed reservation).
	ReservationTTL *OptionalDuration `json:",omitempty"`

	// MaxReservations is the maximum number of active relay slots.
	MaxReservations *OptionalInteger `json:",omitempty"`
	// MaxCircuits is the maximum number of open relay connections for each peer; defaults to 16.
	MaxCircuits *OptionalInteger `json:",omitempty"`
	// BufferSize is the size of the relayed connection buffers.
	BufferSize *OptionalInteger `json:",omitempty"`

	// MaxReservationsPerPeer is the maximum number of reservations originating from the same peer.
	MaxReservationsPerPeer *OptionalInteger `json:",omitempty"`
	// MaxReservationsPerIP is the maximum number of reservations originating from the same IP address.
	MaxReservationsPerIP *OptionalInteger `json:",omitempty"`
	// MaxReservationsPerASN is the maximum number of reservations origination from the same ASN.
	MaxReservationsPerASN *OptionalInteger `json:",omitempty"`
}

RelayService configures the resources of the circuit v2 relay. For every field a reasonable default will be defined in go-ipfs.

type RenterUI

type RenterUI struct {
	Initialized bool
}

type Reprovider

type Reprovider struct {
	Interval *OptionalDuration `json:",omitempty"` // Time period to reprovide locally stored objects to the network
	Strategy *OptionalString   `json:",omitempty"` // Which keys to announce
}

type ResourceMgr

type ResourceMgr struct {
	// Enables the Network Resource Manager feature, default to on.
	Enabled Flag               `json:",omitempty"`
	Limits  *rcmgr.LimitConfig `json:",omitempty"`

	MaxMemory          *OptionalString  `json:",omitempty"`
	MaxFileDescriptors *OptionalInteger `json:",omitempty"`

	// A list of multiaddrs that can bypass normal system limits (but are still
	// limited by the allowlist scope). Convenience config around
	// https://pkg.go.dev/github.com/libp2p/go-libp2p/p2p/host/resource-manager#Allowlist.Add
	Allowlist []string `json:",omitempty"`
}

ResourceMgr defines configuration options for the libp2p Network Resource Manager <https://github.com/libp2p/go-libp2p/tree/master/p2p/host/resource-manager#readme>

type Router

type Router struct {

	// Router type ID. See RouterType for more info.
	Type RouterType

	// Parameters are extra configuration that this router might need.
	// A common one for reframe router is "Endpoint".
	Parameters interface{}
}

type RouterParser

type RouterParser struct {
	Router
}

func (*RouterParser) UnmarshalJSON

func (r *RouterParser) UnmarshalJSON(b []byte) error

type RouterType

type RouterType string

Type is the routing type. Depending of the type we need to instantiate different Routing implementations.

const (
	RouterTypeReframe    RouterType = "reframe"    // More info here: https://github.com/ipfs/specs/tree/main/reframe . Actually deprecated.
	RouterTypeHTTP       RouterType = "http"       // HTTP JSON API for delegated routing systems (IPIP-337).
	RouterTypeDHT        RouterType = "dht"        // DHT router.
	RouterTypeSequential RouterType = "sequential" // Router helper to execute several routers sequentially.
	RouterTypeParallel   RouterType = "parallel"   // Router helper to execute several routers in parallel.
)

type Routers

type Routers map[string]RouterParser

type Routing

type Routing struct {
	// Type sets default daemon routing mode.
	//
	// Can be one of "auto", "dht", "dhtclient", "dhtserver", "none", or "custom".
	// When unset or set to "auto", DHT and implicit routers are used.
	// When "custom" is set, user-provided Routing.Routers is used.
	Type *OptionalString `json:",omitempty"`

	Routers Routers

	Methods Methods
}

Routing defines configuration options for libp2p routing

type Services

type Services struct {
	//StatusServerDomain string
	OnlineServerDomain string
	HubDomain          string
	EscrowDomain       string
	GuardDomain        string
	ExchangeDomain     string
	SolidityDomain     string
	FullnodeDomain     string
	TrongridDomain     string

	EscrowPubKeys []string
	GuardPubKeys  []string
}

func DefaultServicesConfig

func DefaultServicesConfig() Services

DefaultServicesConfig returns the default set of configs for external services.

func DefaultServicesConfigDev

func DefaultServicesConfigDev() Services

DefaultServicesConfigDev returns the default set of configs for dev external services.

func DefaultServicesConfigTestnet

func DefaultServicesConfigTestnet() Services

DefaultServicesConfigTestnet returns the default set of configs for testnet external services.

type Strings

type Strings []string

Strings is a helper type that (un)marshals a single string to/from a single JSON string and a slice of strings to/from a JSON array of strings.

func (Strings) MarshalJSON

func (o Strings) MarshalJSON() ([]byte, error)

MarshalJSON conforms to the json.Marshaler interface.

func (*Strings) UnmarshalJSON

func (o *Strings) UnmarshalJSON(data []byte) error

UnmarshalJSON conforms to the json.Unmarshaler interface.

type SwarmConfig

type SwarmConfig struct {
	// AddrFilters specifies a set libp2p addresses that we should never
	// dial or receive connections from.
	AddrFilters []string

	// DisableBandwidthMetrics disables recording of bandwidth metrics for a
	// slight reduction in memory usage. You probably don't need to set this
	// flag.
	DisableBandwidthMetrics bool

	// DisableNatPortMap turns off NAT port mapping (UPnP, etc.).
	DisableNatPortMap bool

	// DisableRelay explicitly disables the relay transport.
	//
	// Deprecated: This flag is deprecated and is overridden by
	// `Swarm.Transports.Relay` if specified.
	DisableRelay bool `json:",omitempty"`

	// EnableRelayHop makes this node act as a public relay v1
	//
	// Deprecated: The circuit v1 protocol is deprecated.
	// Use `Swarm.RelayService` to configure the circuit v2 relay.
	EnableRelayHop bool `json:",omitempty"`

	// EnableAutoRelay enables the "auto relay user" feature.
	// Node will find and use advertised public relays when it determines that
	// it's not reachable from the public internet.
	//
	// Deprecated: This flag is deprecated and is overridden by
	// `Swarm.RelayClient.Enabled` if specified.
	EnableAutoRelay bool `json:",omitempty"`

	// RelayClient controls the client side of "auto relay" feature.
	// When enabled, the node will use relays if it is not publicly reachable.
	RelayClient RelayClient

	// RelayService.* controls the "relay service".
	// When enabled, node will provide a limited relay service to other peers.
	RelayService RelayService

	// EnableHolePunching enables the hole punching service.
	EnableHolePunching Flag `json:",omitempty"`

	// Transports contains flags to enable/disable libp2p transports.
	Transports Transports

	SwarmKey string

	// ConnMgr configures the connection manager.
	ConnMgr ConnMgr

	// ResourceMgr configures the libp2p Network Resource Manager
	ResourceMgr ResourceMgr
}

type Transformer

type Transformer func(c *Config) error

Transformer is a function which takes configuration and applies some filter to it

type Transports

type Transports struct {
	// Network specifies the base transports we'll use for dialing. To
	// listen on a transport, add the transport to your Addresses.Swarm.
	Network struct {
		// All default to on.
		QUIC      Flag `json:",omitempty"`
		TCP       Flag `json:",omitempty"`
		Websocket Flag `json:",omitempty"`
		Relay     Flag `json:",omitempty"`
		// except WebTransport which is experimental and optin.
		WebTransport Flag `json:",omitempty"`
	}

	// Security specifies the transports used to encrypt insecure network
	// transports.
	Security struct {
		// Defaults to 100.
		TLS Priority `json:",omitempty"`
		// Defaults to 200.
		SECIO Priority `json:",omitempty"`
		// Defaults to 300.
		Noise Priority `json:",omitempty"`
	}

	// Multiplexers specifies the transports used to multiplex multiple
	// connections over a single duplex connection.
	Multiplexers struct {
		// Defaults to 100.
		Yamux Priority `json:",omitempty"`
		// Defaults to 200.
		Mplex Priority `json:",omitempty"`
	}
}

type UI

type UI struct {
	Host   HostUI
	Renter RenterUI
	Wallet WalletUI
}

type WalletUI

type WalletUI struct {
	Initialized bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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