rclone: github.com/ncw/rclone/cmd/serve/httplib/serve Index | Files | Directories

package serve

import "github.com/ncw/rclone/cmd/serve/httplib/serve"

Package serve deals with serving objects over HTTP


Package Files

dir.go serve.go

func Error Uses

func Error(what interface{}, w http.ResponseWriter, text string, err error)

Error logs the error and if a ResponseWriter is given it writes an http.StatusInternalServerError

func Object Uses

func Object(w http.ResponseWriter, r *http.Request, o fs.Object)

Object serves an fs.Object via HEAD or GET

type Crumb Uses

type Crumb struct {
    Link string
    Text string

Crumb is a breadcrumb entry

type DirEntry Uses

type DirEntry struct {
    URL     string
    Leaf    string
    IsDir   bool
    Size    int64
    ModTime time.Time
    // contains filtered or unexported fields

DirEntry is a directory entry

type Directory Uses

type Directory struct {
    DirRemote    string
    Title        string
    Name         string
    Entries      []DirEntry
    Query        string
    HTMLTemplate *template.Template
    Breadcrumb   []Crumb
    Sort         string
    Order        string

Directory represents a directory

func NewDirectory Uses

func NewDirectory(dirRemote string, htmlTemplate *template.Template) *Directory

NewDirectory makes an empty Directory

func (*Directory) AddEntry Uses

func (d *Directory) AddEntry(remote string, isDir bool)

AddEntry adds an entry to that directory

func (*Directory) AddHTMLEntry Uses

func (d *Directory) AddHTMLEntry(remote string, isDir bool, size int64, modTime time.Time)

AddHTMLEntry adds an entry to that directory

func (*Directory) ProcessQueryParams Uses

func (d *Directory) ProcessQueryParams(sortParm string, orderParm string) *Directory

ProcessQueryParams takes and sorts/orders based on the request sort/order parameters and default is namedirfist/asc

func (*Directory) Serve Uses

func (d *Directory) Serve(w http.ResponseWriter, r *http.Request)

Serve serves a directory

func (*Directory) SetQuery Uses

func (d *Directory) SetQuery(queryParams url.Values) *Directory

SetQuery sets the query parameters for each URL



Package serve imports 14 packages (graph) and is imported by 3 packages. Updated 2020-08-03. Refresh now. Tools for package owners.