Merge pull request #1513 from filecoin-project/fix/miner-remote-sealer-addr

Fix/miner remote sealer addr
This commit is contained in:
Łukasz Magiera 2020-04-06 20:36:44 +02:00 committed by GitHub
commit 6c285898a8
2 changed files with 9 additions and 10 deletions

View File

@ -16,7 +16,6 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
record "github.com/libp2p/go-libp2p-record"
"github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
"go.uber.org/fx"
"golang.org/x/xerrors"
@ -338,13 +337,10 @@ func ConfigCommon(cfg *config.Common) Option {
return lr.SetAPIEndpoint(e)
}),
Override(new(sectorstorage.URLs), func(e dtypes.APIEndpoint) (sectorstorage.URLs, error) {
_, ip, err := manet.DialArgs(e)
if err != nil {
return nil, xerrors.Errorf("getting api endpoint dial args: %w", err)
}
ip := cfg.API.RemoteListenAddress
var urls sectorstorage.URLs
urls = append(urls, "http://"+ip+"/remote") // TODO: This makes assumptions, and probably bad ones too
urls = append(urls, "http://"+ip+"/remote") // TODO: This makes no assumptions, and probably could...
return urls, nil
}),
ApplyIf(func(s *Settings) bool { return s.Online },

View File

@ -2,8 +2,9 @@ package config
import (
"encoding"
"github.com/filecoin-project/sector-storage"
"time"
sectorstorage "github.com/filecoin-project/sector-storage"
)
// Common is common config between full node and miner
@ -29,8 +30,9 @@ type StorageMiner struct {
// API contains configs for API endpoint
type API struct {
ListenAddress string
Timeout Duration
ListenAddress string
RemoteListenAddress string
Timeout Duration
}
// Libp2p contains configs for libp2p
@ -72,7 +74,7 @@ func defCommon() Common {
}
// Default returns the default config
// DefaultFullNode returns the default config
func DefaultFullNode() *FullNode {
return &FullNode{
Common: defCommon(),
@ -90,6 +92,7 @@ func DefaultStorageMiner() *StorageMiner {
},
}
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
cfg.Common.API.RemoteListenAddress = "127.0.0.1:2345"
return cfg
}