Documentation ¶
Overview ¶
package config implements the ipfs config file datastructures and utilities.
Index ¶
- Constants
- Variables
- func BootstrapPeerStrings(bps []BootstrapPeer) []string
- func DataStorePath(configroot string) (string, error)
- func Filename(configroot string) (string, error)
- func HumanOutput(value interface{}) ([]byte, error)
- func Marshal(value interface{}) ([]byte, 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 BootstrapPeer
- type Config
- type Datastore
- type Discovery
- type Gateway
- type Identity
- type Ipns
- type MDNS
- type Mounts
- type S3Datastore
- type SupernodeClientConfig
- type SwarmConfig
- type Tour
Constants ¶
const ( // DefaultPathName is the default config dir name DefaultPathName = ".ipfs" // 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 = "IPFS_PATH" )
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"
const CurrentVersionNumber = "0.4.3-rc3"
CurrentVersionNumber is the current application's version literal
const DefaultDataStoreDirectory = "datastore"
DefaultDataStoreDirectory is the directory to store all the local IPFS data.
Variables ¶
var CurrentCommit string
CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
var DefaultBootstrapAddresses = []string{
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
"/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
"/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
"/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
"/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
"/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
"/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
"/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
}
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/ipfs/init.go -- because of an import dependency issue. TODO: move this into a config/default/ package.
var DefaultSNRServers = []string{
"/ip4/104.236.176.52/tcp/4002/ipfs/QmXdb7tWTxdFEQEFgWBqkuYSrZd3mXrC7HxkD4krGNYx2U",
"/ip4/104.236.179.241/tcp/4002/ipfs/QmVRqViDByUxjUMoPnjurjKvZhaEMFDtK35FJXHAM4Lkj6",
"/ip4/104.236.151.122/tcp/4002/ipfs/QmSZwGx8Tn8tmcM4PtDJaMeUQNRhNFdBLVGPzRiNaRJtFH",
"/ip4/162.243.248.213/tcp/4002/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP",
"/ip4/128.199.219.111/tcp/4002/ipfs/Qmb3brdCYmKG1ycwqCbo6LUwWxTuo3FisnJV2yir7oN92R",
"/ip4/104.236.76.40/tcp/4002/ipfs/QmdRBCV8Cz2dGhoKLkD3YjPwVFECmqADQkx5ZteF2c6Fy4",
"/ip4/178.62.158.247/tcp/4002/ipfs/QmUdiMPci7YoEUBkyFZAh2pAbjqcPr7LezyiPD2artLw3v",
"/ip4/178.62.61.185/tcp/4002/ipfs/QmVw6fGNqBixZE4bewRLT2VXX7fAHUHs8JyidDiJ1P7RUN",
}
var ErrInvalidPeerAddr = errors.New("invalid peer address")
ErrInvalidPeerAddr signals an address is not a valid peer address.
Functions ¶
func BootstrapPeerStrings ¶
func BootstrapPeerStrings(bps []BootstrapPeer) []string
func DataStorePath ¶
DataStorePath returns the default data store path given a configuration root (set an empty string to have the default configuration root)
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 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 network API string // address for the local API (RPC) Gateway string // address to listen on for IPFS HTTP object gateway }
Addresses stores the (string) multiaddr addresses for the node.
type BootstrapPeer ¶
BootstrapPeer is a peer used to bootstrap the network.
func DefaultBootstrapPeers ¶
func DefaultBootstrapPeers() ([]BootstrapPeer, 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/ipfs/init) because of module dependency problems.
func ParseBootstrapPeer ¶
func ParseBootstrapPeer(addr string) (BootstrapPeer, error)
func ParseBootstrapPeers ¶
func ParseBootstrapPeers(addrs []string) ([]BootstrapPeer, error)
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 Ipns Ipns // Ipns settings Bootstrap []string // local nodes's bootstrap peer addresses Tour Tour // local node's tour position Gateway Gateway // local node's gateway server options SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled) API API // local node's API settings Swarm SwarmConfig }
Config is used to load IPFS config files.
func (*Config) BootstrapPeers ¶
func (c *Config) BootstrapPeers() ([]BootstrapPeer, error)
func (*Config) SetBootstrapPeers ¶
func (c *Config) SetBootstrapPeers(bps []BootstrapPeer)
type Datastore ¶
type Datastore struct { Type string Path string StorageMax string // in B, kB, kiB, MB, ... StorageGCWatermark int64 // in percentage to multiply on StorageMax GCPeriod string // in ns, us, ms, s, m, h Params *json.RawMessage NoSync bool HashOnRead bool BloomFilterSize int }
Datastore tracks the configuration of the datastore.
type Gateway ¶
type Gateway struct { HTTPHeaders map[string][]string // HTTP headers to return with the gateway RootRedirect string Writable bool PathPrefixes []string }
Gateway contains options for the HTTP gateway server.
type S3Datastore ¶ added in v0.4.0
type SupernodeClientConfig ¶
type SupernodeClientConfig struct {
Servers []string
}
TODO rename
func (*SupernodeClientConfig) ServerIPFSAddrs ¶
func (gcr *SupernodeClientConfig) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error)
type SwarmConfig ¶ added in v0.3.6
type SwarmConfig struct {
AddrFilters []string
}