mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
* 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
19 lines
473 B
Go
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)
|
|
}
|