supernode.go 1.07 KB
Newer Older
1 2 3 4 5 6
package config

import "github.com/jbenet/go-ipfs/util/ipfsaddr"

// TODO replace with final servers before merge

7
// TODO rename
8
type SupernodeClientConfig struct {
9 10 11 12
	Servers []string
}

var DefaultGCRServers = []string{
13 14 15 16 17
	"/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",
18 19
}

20
func initSNRConfig() (*SupernodeClientConfig, error) {
21
	// TODO perform validation
22
	return &SupernodeClientConfig{
23 24 25 26
		Servers: DefaultGCRServers,
	}, nil
}

27
func (gcr *SupernodeClientConfig) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
28 29 30 31 32 33 34 35 36 37
	var addrs []ipfsaddr.IPFSAddr
	for _, server := range gcr.Servers {
		addr, err := ipfsaddr.ParseString(server)
		if err != nil {
			return nil, err
		}
		addrs = append(addrs, addr)
	}
	return addrs, nil
}