1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

fix(corerouting) pass transport addr

This commit is contained in:
Brian Tiger Chow
2015-02-06 13:49:48 -07:00
parent 2a322ad7fb
commit c0ca02486b
4 changed files with 17 additions and 17 deletions

View File

@ -114,7 +114,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
return
}
if routingOption == routingOptionSupernodeKwd {
servers, err := repo.Config().GCR.ServerIPFSAddrs()
servers, err := repo.Config().SupernodeRouting.ServerIPFSAddrs()
if err != nil {
res.SetError(err, cmds.ErrNormal)
repo.Close() // because ownership hasn't been transferred to the node

View File

@ -16,16 +16,16 @@ var log = u.Logger("config")
// Config is used to load IPFS config files.
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
Version Version // local node's version management
Bootstrap []string // local nodes's bootstrap peer addresses
Tour Tour // local node's tour position
Gateway Gateway // local node's gateway server options
GCR GCR // local node's routing servers (if GCR enabled)
Log Log
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
Version Version // local node's version management
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)
Log Log
}
const (

View File

@ -26,7 +26,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
return nil, err
}
gcr, err := initGCR()
snr, err := initSNRConfig()
if err != nil {
return nil, err
}
@ -45,7 +45,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
},
Bootstrap: BootstrapPeerStrings(bootstrapPeers),
GCR: *gcr,
SupernodeRouting: *snr,
Datastore: *ds,
Identity: identity,
Log: Log{

View File

@ -5,7 +5,7 @@ import "github.com/jbenet/go-ipfs/util/ipfsaddr"
// TODO replace with final servers before merge
// TODO rename
type GCR struct {
type SupernodeClientConfig struct {
Servers []string
}
@ -14,14 +14,14 @@ var DefaultGCRServers = []string{
"/ip4/107.170.215.87/tcp/4001/ipfs/QmZDYP9GBjkAmZrS5usSzPnLf41haq6jJhJDmWgnSM4zvW",
}
func initGCR() (*GCR, error) {
func initSNRConfig() (*SupernodeClientConfig, error) {
// TODO perform validation
return &GCR{
return &SupernodeClientConfig{
Servers: DefaultGCRServers,
}, nil
}
func (gcr *GCR) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
func (gcr *SupernodeClientConfig) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
var addrs []ipfsaddr.IPFSAddr
for _, server := range gcr.Servers {
addr, err := ipfsaddr.ParseString(server)