go-ethereum/bzz/roundtripper.go
zelig acf73a4237 bzz API (internal, JS, http)
* SwarmProxyPortFlag --bzzport (8500) to allow multiple instances on a local swarm
* roundtripper proxying to localhost allows bzz protocol uris with test
* bzz/api implements
  * get as per recursive manifest resolution abstracted from httpaccess
  * post
  * getManifest ~ raw
  * download as per full recursive manifest resolution abstracted from httpaccess
  * upload as per bzzup.sh file system directory walkthrough
* bzz/js_api implements js bindings for console delegating to api
* refactor backend - swarm interface: backend simply interacts with bzz.Api
* Api starts http server, resolver is set in JS
2015-05-27 08:29:46 +01:00

19 lines
473 B
Go

package bzz
import (
"fmt"
"net/http"
// "github.com/ethereum/go-ethereum/common/docserver"
// "github.com/ethereum/go-ethereum/jsre"
)
type RoundTripper struct {
Port string
}
func (self *RoundTripper) RoundTrip(req *http.Request) (resp *http.Response, err error) {
url := fmt.Sprintf("http://localhost:%s/%s/%s", self.Port, req.URL.Host, req.URL.Path)
dpaLogger.Infof("roundtripper: proxying request '%s' to '%s'", req.RequestURI, url)
return http.Get(url)
}