diff options
author | Lewis Marshall <lewis@lmars.net> | 2017-05-22 14:56:40 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2017-05-22 14:56:40 +0800 |
commit | 4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5 (patch) | |
tree | 4a9a0867f1634acbd342c4cc9720ed4798355f06 /swarm/swarm.go | |
parent | bc75351edfd820235c7609eefc8b0035e01215b8 (diff) | |
download | dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar.gz dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar.bz2 dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar.lz dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar.xz dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.tar.zst dexon-4a2c17b1ab8316ab3b4fa2b769d1dccad3cb97d5.zip |
cmd/swarm: Add --httpaddr flag (#14475)
Fixes #14474.
Signed-off-by: Lewis Marshall <lewis@lmars.net>
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r-- | swarm/swarm.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go index 442e68d51..4f93a30b7 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -21,6 +21,7 @@ import ( "context" "crypto/ecdsa" "fmt" + "net" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -166,13 +167,13 @@ Start is called when the stack is started * TODO: start subservices like sword, swear, swarmdns */ // implements the node.Service interface -func (self *Swarm) Start(net *p2p.Server) error { +func (self *Swarm) Start(srv *p2p.Server) error { connectPeer := func(url string) error { node, err := discover.ParseNode(url) if err != nil { return fmt.Errorf("invalid node URL: %v", err) } - net.AddPeer(node) + srv.AddPeer(node) return nil } // set chequebook @@ -189,8 +190,8 @@ func (self *Swarm) Start(net *p2p.Server) error { log.Warn(fmt.Sprintf("Starting Swarm service")) self.hive.Start( - discover.PubkeyID(&net.PrivateKey.PublicKey), - func() string { return net.ListenAddr }, + discover.PubkeyID(&srv.PrivateKey.PublicKey), + func() string { return srv.ListenAddr }, connectPeer, ) log.Info(fmt.Sprintf("Swarm network started on bzz address: %v", self.hive.Addr())) @@ -200,17 +201,16 @@ func (self *Swarm) Start(net *p2p.Server) error { // start swarm http proxy server if self.config.Port != "" { - addr := ":" + self.config.Port + addr := net.JoinHostPort(self.config.ListenAddr, self.config.Port) go httpapi.StartHttpServer(self.api, &httpapi.ServerConfig{ Addr: addr, CorsString: self.corsString, }) - } - - log.Debug(fmt.Sprintf("Swarm http proxy started on port: %v", self.config.Port)) + log.Info(fmt.Sprintf("Swarm http proxy started on %v", addr)) - if self.corsString != "" { - log.Debug(fmt.Sprintf("Swarm http proxy started with corsdomain: %v", self.corsString)) + if self.corsString != "" { + log.Debug(fmt.Sprintf("Swarm http proxy started with corsdomain: %v", self.corsString)) + } } return nil |