Documentation ¶
Overview ¶
package config implements the ipfs config file datastructures and utilities.
Index ¶
- Constants
- Variables
- func BootstrapPeerStrings(bps []peer.AddrInfo) []string
- func DataStorePath(configroot string) (string, error)
- func DefaultBootstrapPeers() ([]peer.AddrInfo, error)
- func DefaultTestnetBootstrapPeers() ([]peer.AddrInfo, error)
- func ExternalIP() (string, error)
- func ExternalIPWithPort(extPort, intPort int, swarmAddrs []string) (string, error)
- func Filename(configroot string) (string, error)
- func HumanOutput(value interface{}) ([]byte, error)
- func Marshal(value interface{}) ([]byte, error)
- func MigrateConfig(cfg *Config, inited, hasHval bool) bool
- func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error)
- func Path(configroot, extension string) (string, error)
- func PathRoot() (string, error)
- func ToMap(conf *Config) (map[string]interface{}, error)
- type API
- type Addresses
- type AutoNATConfig
- type AutoNATServiceMode
- type AutoNATThrottleConfig
- type Config
- type ConnMgr
- type Datastore
- type Discovery
- type Duration
- type Experiments
- type Gateway
- type GatewaySpec
- type HostUI
- type Identity
- type Ipns
- type MDNS
- type Mounts
- type Plugin
- type Plugins
- type Profile
- type Provider
- type PubsubConfig
- type RenterUI
- type Reprovider
- type Routing
- type Services
- type Strings
- type SwarmConfig
- type Transformer
- type UI
- type WalletUI
Constants ¶
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" )
const DefaultConnMgrGracePeriod = time.Second * 20
DefaultConnMgrGracePeriod is the default value for the connection managers grace period
const DefaultConnMgrHighWater = 900
DefaultConnMgrHighWater is the default value for the connection managers 'high water' mark
const DefaultConnMgrLowWater = 600
DefaultConnMgrLowWater is the default value for the connection managers 'low water' mark
const DefaultDataStoreDirectory = "datastore"
DefaultDataStoreDirectory is the directory to store all the local IPFS data.
const DefaultEnableAutoRelay = true
const DefaultHostsSyncEnabled = true
DefaultHostSyncEnabled is the default value for the periodic hosts sync from hub
const DefaultHostsSyncMode = hubpb.HostsReq_SCORE
DefaultHostsSyncMode is the default value for the hosts sync mode from hub
const DefaultHostsSyncModeDev = hubpb.HostsReq_TESTNET
const DefaultSwarmKey = `/key/swarm/psk/1.0.0/
/base16/
64ef95289a6b998c776927ed6e33ca8c9202ee47df90141d09f5ffeeb64b8a66`
DefaultSwarmKey is the default swarm key for mainnet BTFS
const DefaultSwarmPort = 4001
DefaultSwarmPort is the default swarm discovery port
const DefaultTestnetSwarmKey = `/key/swarm/psk/1.0.0/
/base16/
d0566ce7e71d880487a89385296ab8a454967e975955ce0e59bff7991d5539d6`
DefaultTestnetSwarmKey is the default swarm key for testnet BTFS
const IdentityTag = "Identity"
const MnemonicSelector = IdentityTag + "." + MnemonicTag
const MnemonicTag = "Mnemonic"
const Password = "Password"
const PasswordSelector = IdentityTag + "." + Password
const PrivKeySelector = IdentityTag + "." + PrivKeyTag
const PrivKeyTag = "PrivKey"
Variables ¶
var DefaultBootstrapAddresses = []string{
"/ip4/18.237.54.123/tcp/4001/p2p/QmWJWGxKKaqZUW4xga2BCzT5FBtYDL8Cc5Q5jywd6xPt1g",
"/ip4/54.213.128.120/tcp/4001/p2p/QmWm3vBCRuZcJMUT9jDZysoYBb66aokmSReX26UaMk8qq5",
"/ip4/34.213.5.20/tcp/4001/p2p/QmQVQBsM7uoJy8hATjTm51uSAkx2y3iGLhSwA6LWLa7iQJ",
"/ip4/18.237.202.91/tcp/4001/p2p/QmbVFdiNkvxtc7Nni7yBWAgtHg8MuyhaZ5mDaYR2ZrhhvN",
"/ip4/13.229.45.41/tcp/4001/p2p/QmX7RZXh27AX8iv2BKLGMgPBiuUpEy8p4LFXgtXAfaZDn9",
"/ip4/54.254.227.188/tcp/4001/p2p/QmYqCq3PasrzLr3PxtLo5D6spEAJ836W9Re9Eo4zUou45U",
"/ip4/52.77.240.134/tcp/4001/p2p/QmURPwdLYesWUDB66EGXvDvwcyV44rVRqV2iGNqKN24eVu",
"/ip4/3.126.224.22/tcp/4001/p2p/QmWTTmvchTodUaVvuKZMo67xk7ZgkxJf4nBo7SZry3vGU5",
"/ip4/18.194.71.27/tcp/4001/p2p/QmYHkY5CrWcvgaDo4PfvzTQgaZtfaqRGDjwW1MrHUj8cLK",
"/ip4/54.93.47.134/tcp/4001/p2p/QmeHaHe7WvjeY37z5MYC3qYQcQcuvDwUhwTXtP3KhKLXXK",
}
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.
var DefaultTestnetBootstrapAddresses = []string{
"/ip4/13.59.69.165/tcp/45301/p2p/16Uiu2HAmFFwNdgSoLhfgJUPEfPEVodppRxaeZBVpAvrH5s3qSkWo",
"/ip4/13.59.69.165/tcp/34237/p2p/16Uiu2HAmDigS3SDx6g9Sp6MUfdFHvDwS8Zw8E14V6bLhCAHA3jjB",
"/ip4/13.59.69.165/tcp/43097/p2p/16Uiu2HAm7HQoEbQe1fYt4LtnG6z5TqwTrrqUv5xsnt4nukskWmAi",
"/ip4/13.59.69.165/tcp/38955/p2p/16Uiu2HAm5WrYvkJwaRP7ZAroWCfjaUxKkNssqcSmEmKJ8vXVYp1o",
"/ip4/13.229.73.63/tcp/36707/p2p/16Uiu2HAmDis3wAorW46YyNmXNk963VAAHwZ1phjHXj5yduyawAUy",
"/ip4/13.229.73.63/tcp/42741/p2p/16Uiu2HAmSfqLCyqH5qQQF8zpzPMQvWiQunhWpYtSxwGw5QR2jhgU",
"/ip4/13.229.73.63/tcp/37403/p2p/16Uiu2HAmBHwyRUETsGqjYpgPRpnMC9y39tcVYH6vKxZidCBcBeFG",
"/ip4/13.229.73.63/tcp/37739/p2p/16Uiu2HAm2oKy37KvYmiv1nnRWZwUoLPZumNKFxPzhM1t8F3KxADu",
"/ip4/3.126.51.74/tcp/40155/p2p/16Uiu2HAmTMEqndByECXuxk1Rg8szxMqwS3tUFFWhAUduFzwfwmfK",
"/ip4/3.126.51.74/tcp/44569/p2p/16Uiu2HAmL4QNi68nSNbedUWp1A1cRR3z3NuJqQYmAYoj19ht6iNv",
"/ip4/3.126.51.74/tcp/39703/p2p/16Uiu2HAkzF6JMx4EL2C4cLoCLyQH8t1sgyttQxPfQtNt5FZhvpxs",
"/ip4/3.126.51.74/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",
}
var ErrInvalidPeerAddr = errors.New("invalid peer address")
ErrInvalidPeerAddr signals an address is not a valid peer address.
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 = "dhtclient" c.AutoNAT.ServiceMode = AutoNATServiceDisabled c.Reprovider.Interval = "0" c.Swarm.ConnMgr.LowWater = 20 c.Swarm.ConnMgr.HighWater = 40 c.Swarm.ConnMgr.GracePeriod = time.Minute.String() 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 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 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-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.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 ¶
BootstrapPeerStrings formats a list of AddrInfos as a bootstrap peer list suitable for serialization.
func DataStorePath ¶
DataStorePath returns the default data store path given a configuration root (set an empty string to have the default configuration root)
func DefaultBootstrapPeers ¶
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 ¶ added in v0.4.1
func ExternalIP ¶ added in v0.1.2
func ExternalIPWithPort ¶ added in v0.4.2
func Filename ¶
Filename returns the configuration file path given a configuration root directory. If the configuration root directory is empty, use the default one
func HumanOutput ¶
HumanOutput gets a config value ready for printing
func MigrateConfig ¶ added in v0.2.0
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 ¶
ParseBootstrapPeer parses a bootstrap list into a list of AddrInfos.
func Path ¶
Path returns the path `extension` relative to the configuration root. If an empty string is provided for `configroot`, the default root is used.
Types ¶
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 ¶ added in v0.6.0
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 ¶ added in v0.6.0
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 ¶ added in v0.6.0
func (m AutoNATServiceMode) MarshalText() ([]byte, error)
func (*AutoNATServiceMode) UnmarshalText ¶ added in v0.6.0
func (m *AutoNATServiceMode) UnmarshalText(text []byte) error
type AutoNATThrottleConfig ¶ added in v0.6.0
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 Duration `json:",omitempty"`
}
AutoNATThrottleConfig configures the throttle limites
type Config ¶
type Config struct { 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 Services Services // External service domains and info Provider Provider Reprovider Reprovider Experimental Experiments UI UI Plugins Plugins }
Config is used to load ipfs config files.
func (*Config) SetBootstrapPeers ¶
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 Duration ¶ added in v0.6.0
Duration wraps time.Duration to provide json serialization and deserialization.
NOTE: the zero value encodes to an empty string.
func (Duration) MarshalText ¶ added in v0.6.0
func (*Duration) UnmarshalText ¶ added in v0.6.0
type Experiments ¶
type Experiments struct { FilestoreEnabled bool UrlstoreEnabled bool ShardingEnabled bool GraphsyncEnabled bool Libp2pStreamMounting bool P2pHttpProxy bool QUIC bool StrategicProviding bool StorageHostEnabled bool StorageClientEnabled bool Analytics bool RemoveOnUnpin bool HostsSyncEnabled bool HostsSyncMode string DisableAutoUpdate bool }
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 // Writable enables PUT/POST request handling by this gateway. Usually, // writing is done through the API, not the gateway. Writable bool // PathPrefixes is an array of acceptable url paths that a client can // specify in X-Ipfs-Path-Prefix header. // // The X-Ipfs-Path-Prefix header is used to specify a base path to prepend // to links in directory listings and for trailing-slash redirects. It is // intended to be set by a frontend http proxy like nginx. // // Example: To mount blog.ipfs.io (a DNSLink site) at ipfs.io/blog // set PathPrefixes to ["/blog"] and nginx config to translate paths // and pass Host header (for DNSLink): // location /blog/ { // rewrite "^/blog(/.*)$" $1 break; // proxy_set_header Host blog.ipfs.io; // proxy_set_header X-Ipfs-Gateway-Prefix /blog; // proxy_pass http://127.0.0.1:8080; // } PathPrefixes []string // FIXME: Not yet implemented 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 overriden 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 ¶ added in v0.6.0
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 PathPrefixes // 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 }
type Identity ¶
type Identity struct { PeerID string PrivKey string `json:",omitempty"` Mnemonic string `json:",omitempty"` Password string `json:",omitempty"` }
Identity tracks the configuration of the local node's identity.
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 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 // StrictSignatureVerification enables strict signature verification. // When enabled, unsigned messages will be rejected. Eventually, this // will be made the default and this option will disappear. Once this // happens, networks will either need to completely disable or // completely enable message signing. StrictSignatureVerification bool }
type Reprovider ¶
type Routing ¶
type Routing struct { // Type sets default daemon routing mode. // // Can be one of "dht", "dhtclient", "dhtserver", "none", or unset. Type string }
Routing defines configuration options for libp2p routing
type Services ¶ added in v0.2.0
type Services struct { StatusServerDomain string HubDomain string EscrowDomain string GuardDomain string ExchangeDomain string SolidityDomain string EscrowPubKeys []string GuardPubKeys []string }
func DefaultServicesConfig ¶ added in v0.2.0
func DefaultServicesConfig() Services
DefaultServicesConfig returns the default set of configs for external services.
func DefaultServicesConfigDev ¶ added in v0.3.0
func DefaultServicesConfigDev() Services
DefaultServicesConfigDev returns the default set of configs for dev external services.
func DefaultServicesConfigTestnet ¶ added in v0.4.1
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 ¶
MarshalJSON conforms to the json.Marshaler interface.
func (*Strings) UnmarshalJSON ¶
UnmarshalJSON conforms to the json.Unmarshaler interface.
type SwarmConfig ¶
type SwarmConfig struct { AddrFilters []string DisableBandwidthMetrics bool DisableNatPortMap bool DisableRelay bool EnableRelayHop bool SwarmKey string // autorelay functionality // if true, then the libp2p host will be constructed with autorelay functionality. EnableAutoRelay bool ConnMgr ConnMgr }
type Transformer ¶
Transformer is a function which takes configuration and applies some filter to it