Documentation ¶
Overview ¶
Package gowebdav is a WebDAV client library with a command line tool included.
Index ¶
- func FixSlash(s string) string
- func FixSlashes(s string) string
- func Join(path0 string, path1 string) string
- func PathEscape(path string) string
- func ReadConfig(uri, netrc string) (string, string)
- func String(r io.Reader) string
- type Authenticator
- type BasicAuth
- type Client
- func (c *Client) Connect() error
- func (c *Client) Copy(oldpath, newpath string, overwrite bool) error
- func (c *Client) Mkdir(path string, _ os.FileMode) error
- func (c *Client) MkdirAll(path string, _ os.FileMode) error
- func (c *Client) Read(path string) ([]byte, error)
- func (c *Client) ReadDir(path string) ([]os.FileInfo, error)
- func (c *Client) ReadStream(path string) (io.ReadCloser, error)
- func (c *Client) Remove(path string) error
- func (c *Client) RemoveAll(path string) error
- func (c *Client) Rename(oldpath, newpath string, overwrite bool) error
- func (c *Client) SetHeader(key, value string)
- func (c *Client) SetTimeout(timeout time.Duration)
- func (c *Client) SetTransport(transport http.RoundTripper)
- func (c *Client) Stat(path string) (os.FileInfo, error)
- func (c *Client) Write(path string, data []byte, _ os.FileMode) error
- func (c *Client) WriteStream(path string, stream io.Reader, _ os.FileMode) error
- type DigestAuth
- type File
- type NoAuth
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixSlashes ¶
FixSlashes appends and prepends a / if they are missing
func PathEscape ¶
PathEscape escapes all segemnts of a given path
Example ¶
fmt.Println(PathEscape("")) fmt.Println(PathEscape("/")) fmt.Println(PathEscape("/web")) fmt.Println(PathEscape("/web/")) fmt.Println(PathEscape("/w e b/d a v/s%u&c#k:s/"))
Output: / /web /web/ /w%20e%20b/d%20a%20v/s%25u&c%23k:s/
func ReadConfig ¶
ReadConfig reads login and password configuration from ~/.netrc machine foo.com login username password 123456
Types ¶
type Authenticator ¶
type Authenticator interface { Type() string User() string Pass() string Authorize(*Client, string, string) }
Authenticator stub
type BasicAuth ¶
type BasicAuth struct {
// contains filtered or unexported fields
}
BasicAuth structure holds our credentials
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines our structure
func (*Client) ReadStream ¶
func (c *Client) ReadStream(path string) (io.ReadCloser, error)
ReadStream reads the stream for a given path
func (*Client) SetTimeout ¶
SetTimeout exposes the ability to set a time limit for requests
func (*Client) SetTransport ¶
func (c *Client) SetTransport(transport http.RoundTripper)
SetTransport exposes the ability to define custom transports
type DigestAuth ¶
type DigestAuth struct {
// contains filtered or unexported fields
}
DigestAuth structure holds our credentials
func (*DigestAuth) Authorize ¶
func (d *DigestAuth) Authorize(c *Client, method string, path string)
Authorize the current request
func (*DigestAuth) Type ¶
func (d *DigestAuth) Type() string
Type identifies the DigestAuthenticator
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is our structure for a given file
func (File) ContentType ¶
ContentType returns the content type of a file