Documentation
¶
Index ¶
- Constants
- Variables
- type FS
- func (f *FS) AcceptUserAllowRequests(ch chan<- UserRequest)
- func (f *FS) AutoUserAllowRequests(allow UserAllow, until time.Time)
- func (f *FS) IsUserAllowed(ctx context.Context, req UserRequest) bool
- func (f *FS) IsUserAllowedFast(ctx context.Context, req UserRequest) bool
- func (f *FS) Root() (fs.Node, error)
- func (f *FS) SetLogger(logger interface{ ... })
- func (f *FS) SetUserAllowed(threadPID uint32, path string, allow UserAllow)
- func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error
- func (f *FS) StopUserAllowRequests()
- type UserAllow
- type UserRequest
Constants ¶
const UserAllowedDefaultTimeout = 10 * time.Second
UserAllowedDefaultTimeout is the default timeout for waiting for a response from the user.
Variables ¶
var ErrUserNotAllowed = userNotAllowedError(syscall.EACCES)
ErrUserNotAllowed is returned if the user denied access or timed out waiting for a response.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS for user files, such as their home, documents, other personal files.
func (*FS) AcceptUserAllowRequests ¶
func (f *FS) AcceptUserAllowRequests(ch chan<- UserRequest)
AcceptUserAllowRequests - paths are sent to the channel, use SetUserAllowed to respond. If the channel is full, requests are dropped. Note that if SetUserAllowed is not called on a path sent to the channel, said path will not be sent again. (The previous statement is not true in the case of StopUserAllowRequests and AutoUserAllowRequests) If asking the user to accept/deny, consider using UserAllowNoneOnce if they take too long (timeout)
func (*FS) AutoUserAllowRequests ¶
AutoUserAllowRequests - While the current time is less than until, any user allow reqeusts are suppressed and auto replied with allow. To cancel early, call again with a time not in the future (such as Now, or time.Time's zero value) Note: any previous and future SetUserAllowed calls still apply! they override the auto requests.
func (*FS) IsUserAllowed ¶
func (f *FS) IsUserAllowed(ctx context.Context, req UserRequest) bool
IsUserAllowed - is the user allowed? waits for up to UserAllowedDefaultTimeout for the user to respond.
func (*FS) IsUserAllowedFast ¶
func (f *FS) IsUserAllowedFast(ctx context.Context, req UserRequest) bool
IsUserAllowedFast - quickly checks if the user allowed, without waiting.
func (*FS) SetLogger ¶
func (f *FS) SetLogger(logger interface { Print(v ...interface{}) Printf(format string, v ...interface{}) })
SetLogger sets the logger.
func (*FS) SetUserAllowed ¶
SetUserAllowed responds to a path user request.
func (*FS) Statfs ¶
func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) error
Statfs is the FS statistics info.
func (*FS) StopUserAllowRequests ¶
func (f *FS) StopUserAllowRequests()
StopUserAllowRequests - Requests will not be sent after this call.
type UserRequest ¶
type UserRequest struct { Deadline time.Time Path string Action string UID, GID uint32 ThreadPID uint32 // The thread, or 0 if not known. PID uint32 // The process, or 0 if not known. }
Note: PID can be 0 if not known or it is the OS.
func (UserRequest) Command ¶
func (req UserRequest) Command() string