Documentation ¶
Overview ¶
A simple http server interface to Swarm
Index ¶
- func StartHttpServer(api *api.Api, config *ServerConfig)
- type Request
- type RoundTripper
- type Server
- func (s *Server) BadRequest(w http.ResponseWriter, r *Request, reason string)
- func (s *Server) Error(w http.ResponseWriter, r *Request, err error)
- func (s *Server) HandleDelete(w http.ResponseWriter, r *Request)
- func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request)
- func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request)
- func (s *Server) HandleGetList(w http.ResponseWriter, r *Request)
- func (s *Server) HandleGetRaw(w http.ResponseWriter, r *Request)
- func (s *Server) HandlePostFiles(w http.ResponseWriter, r *Request)
- func (s *Server) HandlePostRaw(w http.ResponseWriter, r *Request)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartHttpServer ¶
func StartHttpServer(api *api.Api, config *ServerConfig)
starts up http server
Types ¶
type RoundTripper ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) BadRequest ¶
func (s *Server) BadRequest(w http.ResponseWriter, r *Request, reason string)
func (*Server) HandleDelete ¶
func (s *Server) HandleDelete(w http.ResponseWriter, r *Request)
HandleDelete handles a DELETE request to bzz:/<manifest>/<path>, removes <path> from <manifest> and returns the resulting manifest hash as a text/plain response
func (*Server) HandleGetFile ¶
func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request)
HandleGetFile handles a GET request to bzz://<manifest>/<path> and responds with the content of the file at <path> from the given <manifest>
func (*Server) HandleGetFiles ¶
func (s *Server) HandleGetFiles(w http.ResponseWriter, r *Request)
HandleGetFiles handles a GET request to bzz:/<manifest> with an Accept header of "application/x-tar" and returns a tar stream of all files contained in the manifest
func (*Server) HandleGetList ¶
func (s *Server) HandleGetList(w http.ResponseWriter, r *Request)
HandleGetList handles a GET request to bzz:/<manifest>/<path> which has the "list" query parameter set to "true" and returns a list of all files contained in <manifest> under <path> grouped into common prefixes using "/" as a delimiter
func (*Server) HandleGetRaw ¶
func (s *Server) HandleGetRaw(w http.ResponseWriter, r *Request)
HandleGetRaw handles a GET request to bzzr://<key> and responds with the raw content stored at the given storage key
func (*Server) HandlePostFiles ¶
func (s *Server) HandlePostFiles(w http.ResponseWriter, r *Request)
HandlePostFiles handles a POST request (or deprecated PUT request) to bzz:/<hash>/<path> which contains either a single file or multiple files (either a tar archive or multipart form), adds those files either to an existing manifest or to a new manifest under <path> and returns the resulting manifest hash as a text/plain response
func (*Server) HandlePostRaw ¶
func (s *Server) HandlePostRaw(w http.ResponseWriter, r *Request)
HandlePostRaw handles a POST request to a raw bzzr:/ URI, stores the request body in swarm and returns the resulting storage key as a text/plain response
type ServerConfig ¶
ServerConfig is the basic configuration needed for the HTTP server and also includes CORS settings.