swarm/api/http: http package refactoring 1/5 and 2/5 (#17164)

This commit is contained in:
Anton Evangelatov
2018-07-12 15:42:45 +02:00
committed by Balint Gabor
parent facf1bc9d6
commit f7d3678c28
6 changed files with 584 additions and 386 deletions

View File

@ -388,10 +388,9 @@ func (self *Swarm) Start(srv *p2p.Server) error {
// start swarm http proxy server
if self.config.Port != "" {
addr := net.JoinHostPort(self.config.ListenAddr, self.config.Port)
go httpapi.StartHTTPServer(self.api, &httpapi.ServerConfig{
Addr: addr,
CorsString: self.config.Cors,
})
server := httpapi.NewServer(self.api, self.config.Cors)
go server.ListenAndServe(addr)
}
log.Debug(fmt.Sprintf("Swarm http proxy started on port: %v", self.config.Port))