compositedav

package
v1.62.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package compositedav provides an http.Handler that composes multiple WebDAV services into a single WebDAV service that presents each of them as its own folder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Child

type Child struct {
	*dirfs.Child

	// BaseURL is the base URL of the WebDAV service to which we'll proxy
	// requests for this Child. We will append the filename from the original
	// URL to this.
	BaseURL string

	// Transport (if specified) is the http transport to use when communicating
	// with this Child's WebDAV service.
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

Child is a child folder of this compositedav.

func (*Child) CloseIdleConnections

func (c *Child) CloseIdleConnections()

CloseIdleConnections forcibly closes any idle connections on this Child's reverse proxy.

type Handler

type Handler struct {
	// Logf specifies a logging function to use.
	Logf logger.Logf

	// Clock, if specified, determines the current time. If not specified, we
	// default to time.Now().
	Clock tstime.Clock

	// StatCache is an optional cache for PROPFIND results.
	StatCache *StatCache
	// contains filtered or unexported fields
}

Handler implements http.Handler by using a dirfs.FS for showing a virtual read-only folder that represents the Child WebDAV services as sub-folders and proxying all requests for resources on the children to those children via httputil.ReverseProxy instances.

func (*Handler) Close

func (h *Handler) Close()

Close closes this Handler,including closing all idle connections on children and stopping the StatCache (if caching is enabled).

func (*Handler) GetChild

func (h *Handler) GetChild(name string) *Child

GetChild gets the Child identified by name, or nil if no matching child found.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

func (*Handler) SetChildren

func (h *Handler) SetChildren(staticRoot string, children ...*Child)

SetChildren replaces the entire existing set of children with the given ones. If staticRoot is given, the children will appear with a subfolder bearing named <staticRoot>.

type StatCache

type StatCache struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

StatCache provides a cache for directory listings and file metadata. Especially when used from the command-line, mapped WebDAV drives can generate repetitive requests for the same file metadata. This cache helps reduce the number of round-trips to the WebDAV server for such requests. This is similar to the DirectoryCacheLifetime setting of Windows' built-in SMB client, see https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-7/ff686200(v=ws.10)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL