Documentation
¶
Overview ¶
Package files is the Files module: a file browser over a small set of named places (root directories on this machine), for the owner and for the agent.
Every path is a place and a path relative to it. locate resolves and checks each one: nothing outside a place is reached, by ".." or through a symbolic link, and files that look like credentials are refused (see sensitive). Nothing is ever overwritten except a text file by a write that names it, and there is no recursive delete.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Name string `json:"name"`
// Path is relative to the place, slash separated.
Path string `json:"path"`
Dir bool `json:"dir"`
// Size is in bytes; zero for a folder.
Size int64 `json:"size"`
// Modified is RFC 3339, UTC.
Modified string `json:"modified"`
Symlink bool `json:"symlink,omitempty"`
// Locked marks an entry on the denylist: it is listed, and nothing else can be done
// with it.
Locked bool `json:"locked,omitempty"`
}
Entry is one item of a folder listing.
type Match ¶
type Match struct {
// Path is relative to the place, slash separated.
Path string `json:"path"`
Line int `json:"line"`
Text string `json:"text"`
}
Match is one matching line.
type Place ¶
type Place struct {
// ID is a short slug made from the name ("home", "work-notes").
ID string `json:"id"`
Name string `json:"name"`
// Path is the absolute path of the root directory.
Path string `json:"path"`
}
Place is a named root directory on this machine. Files reaches nothing outside its places.
type Text ¶
type Text struct {
Text string `json:"text"`
// Truncated says the file goes on after Text.
Truncated bool `json:"truncated"`
// Size is the whole file's size in bytes.
Size int64 `json:"size"`
// StartLine and EndLine are the first and last line in Text, counted from 1. EndLine
// is zero when Text is empty.
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
}
Text is part of a text file.