github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/repo/config/supernode.go (about)

     1  package config
     2  
     3  import "github.com/ipfs/go-ipfs/util/ipfsaddr"
     4  
     5  // TODO replace with final servers before merge
     6  
     7  // TODO rename
     8  type SupernodeClientConfig struct {
     9  	Servers []string
    10  }
    11  
    12  var DefaultSNRServers = []string{
    13  	"/ip4/104.236.176.52/tcp/4002/ipfs/QmXdb7tWTxdFEQEFgWBqkuYSrZd3mXrC7HxkD4krGNYx2U",
    14  	"/ip4/104.236.179.241/tcp/4002/ipfs/QmVRqViDByUxjUMoPnjurjKvZhaEMFDtK35FJXHAM4Lkj6",
    15  	"/ip4/104.236.151.122/tcp/4002/ipfs/QmSZwGx8Tn8tmcM4PtDJaMeUQNRhNFdBLVGPzRiNaRJtFH",
    16  	"/ip4/162.243.248.213/tcp/4002/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP",
    17  	"/ip4/128.199.219.111/tcp/4002/ipfs/Qmb3brdCYmKG1ycwqCbo6LUwWxTuo3FisnJV2yir7oN92R",
    18  	"/ip4/104.236.76.40/tcp/4002/ipfs/QmdRBCV8Cz2dGhoKLkD3YjPwVFECmqADQkx5ZteF2c6Fy4",
    19  	"/ip4/178.62.158.247/tcp/4002/ipfs/QmUdiMPci7YoEUBkyFZAh2pAbjqcPr7LezyiPD2artLw3v",
    20  	"/ip4/178.62.61.185/tcp/4002/ipfs/QmVw6fGNqBixZE4bewRLT2VXX7fAHUHs8JyidDiJ1P7RUN",
    21  }
    22  
    23  func initSNRConfig() (*SupernodeClientConfig, error) {
    24  	// TODO perform validation
    25  	return &SupernodeClientConfig{
    26  		Servers: DefaultSNRServers,
    27  	}, nil
    28  }
    29  
    30  func (gcr *SupernodeClientConfig) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
    31  	var addrs []ipfsaddr.IPFSAddr
    32  	for _, server := range gcr.Servers {
    33  		addr, err := ipfsaddr.ParseString(server)
    34  		if err != nil {
    35  			return nil, err
    36  		}
    37  		addrs = append(addrs, addr)
    38  	}
    39  	return addrs, nil
    40  }