mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
fix(corerouting) pass transport addr
This commit is contained in:
@ -114,7 +114,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if routingOption == routingOptionSupernodeKwd {
|
if routingOption == routingOptionSupernodeKwd {
|
||||||
servers, err := repo.Config().GCR.ServerIPFSAddrs()
|
servers, err := repo.Config().SupernodeRouting.ServerIPFSAddrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.SetError(err, cmds.ErrNormal)
|
res.SetError(err, cmds.ErrNormal)
|
||||||
repo.Close() // because ownership hasn't been transferred to the node
|
repo.Close() // because ownership hasn't been transferred to the node
|
||||||
|
@ -24,7 +24,7 @@ type Config struct {
|
|||||||
Bootstrap []string // local nodes's bootstrap peer addresses
|
Bootstrap []string // local nodes's bootstrap peer addresses
|
||||||
Tour Tour // local node's tour position
|
Tour Tour // local node's tour position
|
||||||
Gateway Gateway // local node's gateway server options
|
Gateway Gateway // local node's gateway server options
|
||||||
GCR GCR // local node's routing servers (if GCR enabled)
|
SupernodeRouting SupernodeClientConfig // local node's routing servers (if SupernodeRouting enabled)
|
||||||
Log Log
|
Log Log
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gcr, err := initGCR()
|
snr, err := initSNRConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Bootstrap: BootstrapPeerStrings(bootstrapPeers),
|
Bootstrap: BootstrapPeerStrings(bootstrapPeers),
|
||||||
GCR: *gcr,
|
SupernodeRouting: *snr,
|
||||||
Datastore: *ds,
|
Datastore: *ds,
|
||||||
Identity: identity,
|
Identity: identity,
|
||||||
Log: Log{
|
Log: Log{
|
||||||
|
@ -5,7 +5,7 @@ import "github.com/jbenet/go-ipfs/util/ipfsaddr"
|
|||||||
// TODO replace with final servers before merge
|
// TODO replace with final servers before merge
|
||||||
|
|
||||||
// TODO rename
|
// TODO rename
|
||||||
type GCR struct {
|
type SupernodeClientConfig struct {
|
||||||
Servers []string
|
Servers []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,14 +14,14 @@ var DefaultGCRServers = []string{
|
|||||||
"/ip4/107.170.215.87/tcp/4001/ipfs/QmZDYP9GBjkAmZrS5usSzPnLf41haq6jJhJDmWgnSM4zvW",
|
"/ip4/107.170.215.87/tcp/4001/ipfs/QmZDYP9GBjkAmZrS5usSzPnLf41haq6jJhJDmWgnSM4zvW",
|
||||||
}
|
}
|
||||||
|
|
||||||
func initGCR() (*GCR, error) {
|
func initSNRConfig() (*SupernodeClientConfig, error) {
|
||||||
// TODO perform validation
|
// TODO perform validation
|
||||||
return &GCR{
|
return &SupernodeClientConfig{
|
||||||
Servers: DefaultGCRServers,
|
Servers: DefaultGCRServers,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gcr *GCR) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
|
func (gcr *SupernodeClientConfig) ServerIPFSAddrs() ([]ipfsaddr.IPFSAddr, error) {
|
||||||
var addrs []ipfsaddr.IPFSAddr
|
var addrs []ipfsaddr.IPFSAddr
|
||||||
for _, server := range gcr.Servers {
|
for _, server := range gcr.Servers {
|
||||||
addr, err := ipfsaddr.ParseString(server)
|
addr, err := ipfsaddr.ParseString(server)
|
Reference in New Issue
Block a user