diff --git a/node/builder.go b/node/builder.go index 400e936b1..d12eee363 100644 --- a/node/builder.go +++ b/node/builder.go @@ -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 }, diff --git a/node/config/def.go b/node/config/def.go index 483fcf4d0..f848ce325 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -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 }