dav

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dav integrates IServ RFC 4918 WebDAV, RFC 4791 CalDAV/iCal, and RFC 6352 CardDAV/vCard endpoints using github.com/emersion/go-webdav, go-ical, and go-vcard with XXE and bounded-body hardening.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsafeXML = errors.New("xml contains disallowed doctype or entity declaration")

ErrUnsafeXML is returned when an XML document contains disallowed DOCTYPE or ENTITY declarations.

Functions

func CheckSafeXML

func CheckSafeXML(raw []byte) error

CheckSafeXML rejects XML payloads containing DOCTYPE or ENTITY declarations to guard against XXE and entity-expansion attacks.

func DownloadWebDAV

func DownloadWebDAV(
	ctx context.Context,
	sess *session.Session,
	filePath string,
) (io.ReadCloser, string, int64, string, error)

DownloadWebDAV opens a live download stream for filePath from IServ WebDAV. Callers must close the returned io.ReadCloser.

func SanitizePath

func SanitizePath(raw string, allowRoot bool) (string, error)

SanitizePath normalizes a WebDAV path and rejects null bytes and '..' traversal segments.

Types

type CardDAVContact

type CardDAVContact struct {
	UID        string
	FullName   string
	FirstName  string
	LastName   string
	Email      string
	Role       string
	Department string
	Groups     []string
}

CardDAVContact represents a contact entry parsed from vCard / CardDAV responses.

func ParseVCardContacts

func ParseVCardContacts(raw string) []CardDAVContact

ParseVCardContacts parses one or more RFC 2426 / 6350 VCARD blocks using github.com/emersion/go-vcard.

func SearchCardDAVContacts

func SearchCardDAVContacts(ctx context.Context, sess *session.Session, query string) ([]CardDAVContact, error)

SearchCardDAVContacts discovers IServ CardDAV addressbooks and queries contacts using github.com/emersion/go-webdav/carddav and github.com/emersion/go-vcard.

type ICalEvent

type ICalEvent struct {
	UID         string
	Summary     string
	Description string
	Location    string
	Start       time.Time
	End         time.Time
	AllDay      bool
	Categories  []string
}

ICalEvent represents a parsed VEVENT component from RFC 5545 iCalendar data.

func FetchCalDAVEvents

func FetchCalDAVEvents(
	ctx context.Context,
	sess *session.Session,
	caldavPath string,
	start, end time.Time,
) ([]ICalEvent, error)

FetchCalDAVEvents queries an IServ CalDAV endpoint using emersion/go-webdav/caldav and returns VEVENT items overlapping [start, end].

func ParseICalEvents

func ParseICalEvents(raw string) []ICalEvent

ParseICalEvents parses RFC 5545 iCalendar text using github.com/emersion/go-ical.

type WebDAVEntry

type WebDAVEntry struct {
	Href        string
	Path        string
	Name        string
	IsDir       bool
	Size        int64
	ContentType string
	ModifiedAt  *time.Time
	ETag        string
}

WebDAVEntry describes a single file or directory returned by IServ WebDAV PROPFIND.

func ListWebDAV

func ListWebDAV(ctx context.Context, sess *session.Session, dirPath string) ([]WebDAVEntry, error)

ListWebDAV performs a Depth: 1 PROPFIND against /webdav/<dirPath> via emersion/go-webdav.

Jump to

Keyboard shortcuts

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