$ show emersion/go-webdav
go-webdav is a Go library implementing WebDAV (RFC 4918), CalDAV (RFC 4791), and CardDAV (RFC 6352) protocols. It provides client and server implementations for these protocols, with a clear separation between the HTTP handling layer and storage backends via a FileSystem interface. The library includes a command-line tool to run a WebDAV server serving a local directory. The architecture is modular, with core WebDAV functionality in the 'webdav' package, CalDAV and CardDaV extensions in their respective packages, and low-level HTTP/XML handling in the 'internal' package. The library depends on go-ical and go-vcard for calendar and contact data processing.
The LLM identified 2 files worth highlighting for reuse:
Provides the RawXMLValue type that implements xml.Marshaler and xml.Unmarshaler to delay XML parsing or precompute XML encoding. This allows flexible XML handling where parsing can be deferred until needed or XML can be generated without struct marshaling. It demonstrates non-obvious skill in leveraging Go's XML token API and has zero dependencies beyond the standard library, making it easily reusable in any XML-processing project.
Contains the DiscoverContextURL function that implements DNS-based service discovery per RFC 6764. Given a service name and domain, it queries SRV and TXT records to construct a service URL (e.g., for CalDAV/CardDAV). This is a generic implementation usable for any service following the RFC 6764 pattern (like LDAP, XMPP). It shows correct handling of SRV prioritization, TXT record parsing, and URL construction, with no dependencies beyond the standard library.