Documentation
¶
Index ¶
- type AfterHookCallback
- type AfterHookFunc
- type BeforeHookCallback
- type BeforeHookFunc
- type DirEntry
- type FileInfo
- type Handle
- type Hook
- type HookAction
- type HookEngine
- type HookFileMeta
- type HookMatcher
- type HookMatcherFunc
- type HookOp
- type HookPhase
- type HookRequest
- type HookResult
- type HookRule
- type MemoryProvider
- func (p *MemoryProvider) Chmod(path string, mode os.FileMode) error
- func (p *MemoryProvider) Create(path string, mode os.FileMode) (Handle, error)
- func (p *MemoryProvider) Mkdir(path string, mode os.FileMode) error
- func (p *MemoryProvider) MkdirAll(path string, mode os.FileMode) error
- func (p *MemoryProvider) Open(path string, flags int, mode os.FileMode) (Handle, error)
- func (p *MemoryProvider) ReadDir(path string) ([]DirEntry, error)
- func (p *MemoryProvider) ReadFile(path string) ([]byte, error)
- func (p *MemoryProvider) Readlink(path string) (string, error)
- func (p *MemoryProvider) Readonly() bool
- func (p *MemoryProvider) Remove(path string) error
- func (p *MemoryProvider) RemoveAll(path string) error
- func (p *MemoryProvider) Rename(oldPath, newPath string) error
- func (p *MemoryProvider) Stat(path string) (FileInfo, error)
- func (p *MemoryProvider) Symlink(target, link string) error
- func (p *MemoryProvider) WriteFile(path string, data []byte, mode os.FileMode) error
- type MountRouter
- func (r *MountRouter) AddMount(path string, provider Provider)
- func (r *MountRouter) Chmod(path string, mode os.FileMode) error
- func (r *MountRouter) Create(path string, mode os.FileMode) (Handle, error)
- func (r *MountRouter) Mkdir(path string, mode os.FileMode) error
- func (r *MountRouter) Open(path string, flags int, mode os.FileMode) (Handle, error)
- func (r *MountRouter) ReadDir(path string) ([]DirEntry, error)
- func (r *MountRouter) Readlink(path string) (string, error)
- func (r *MountRouter) Readonly() bool
- func (r *MountRouter) Remove(path string) error
- func (r *MountRouter) RemoveAll(path string) error
- func (r *MountRouter) RemoveMount(path string)
- func (r *MountRouter) Rename(oldPath, newPath string) error
- func (r *MountRouter) Stat(path string) (FileInfo, error)
- func (r *MountRouter) Symlink(target, link string) error
- type MutateWriteFunc
- type MutateWriteRequest
- type OpCode
- type OpPathMatcher
- type Provider
- type ReadonlyProvider
- func (p *ReadonlyProvider) Chmod(path string, mode os.FileMode) error
- func (p *ReadonlyProvider) Create(path string, mode os.FileMode) (Handle, error)
- func (p *ReadonlyProvider) Mkdir(path string, mode os.FileMode) error
- func (p *ReadonlyProvider) Open(path string, flags int, mode os.FileMode) (Handle, error)
- func (p *ReadonlyProvider) ReadDir(path string) ([]DirEntry, error)
- func (p *ReadonlyProvider) Readlink(path string) (string, error)
- func (p *ReadonlyProvider) Readonly() bool
- func (p *ReadonlyProvider) Remove(path string) error
- func (p *ReadonlyProvider) RemoveAll(path string) error
- func (p *ReadonlyProvider) Rename(oldPath, newPath string) error
- func (p *ReadonlyProvider) Stat(path string) (FileInfo, error)
- func (p *ReadonlyProvider) Symlink(target, link string) error
- type RealFSProvider
- func (p *RealFSProvider) Chmod(path string, mode os.FileMode) error
- func (p *RealFSProvider) Create(path string, mode os.FileMode) (Handle, error)
- func (p *RealFSProvider) Mkdir(path string, mode os.FileMode) error
- func (p *RealFSProvider) Open(path string, flags int, mode os.FileMode) (Handle, error)
- func (p *RealFSProvider) ReadDir(path string) ([]DirEntry, error)
- func (p *RealFSProvider) Readlink(path string) (string, error)
- func (p *RealFSProvider) Readonly() bool
- func (p *RealFSProvider) Remove(path string) error
- func (p *RealFSProvider) RemoveAll(path string) error
- func (p *RealFSProvider) Rename(oldPath, newPath string) error
- func (p *RealFSProvider) Stat(path string) (FileInfo, error)
- func (p *RealFSProvider) Symlink(target, link string) error
- type VFSDirEntry
- type VFSRequest
- type VFSResponse
- type VFSServer
- type VFSStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterHookCallback ¶ added in v0.1.19
type AfterHookCallback interface {
After(ctx context.Context, req HookRequest, result HookResult)
}
AfterHookCallback runs after the target VFS operation.
type AfterHookFunc ¶ added in v0.1.19
type AfterHookFunc func(ctx context.Context, req HookRequest, result HookResult)
AfterHookFunc adapts a function into AfterHookCallback.
func (AfterHookFunc) After ¶ added in v0.1.19
func (f AfterHookFunc) After(ctx context.Context, req HookRequest, result HookResult)
type BeforeHookCallback ¶ added in v0.1.19
type BeforeHookCallback interface {
Before(ctx context.Context, req *HookRequest) error
}
BeforeHookCallback runs inline before the target VFS operation.
type BeforeHookFunc ¶ added in v0.1.19
type BeforeHookFunc func(ctx context.Context, req *HookRequest) error
BeforeHookFunc adapts a function into BeforeHookCallback.
func (BeforeHookFunc) Before ¶ added in v0.1.19
func (f BeforeHookFunc) Before(ctx context.Context, req *HookRequest) error
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
func NewDirEntry ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
func NewFileInfo ¶
func NewFileInfoWithSys ¶ added in v0.1.19
type Hook ¶ added in v0.1.19
type Hook struct {
Name string
Phase HookPhase
Matcher HookMatcher
Before BeforeHookCallback
After AfterHookCallback
// Async enqueues after-callback execution on the hook worker.
Async bool
// SideEffect marks callbacks that should be suppressed while hook-triggered
// side effects are in-flight.
SideEffect bool
}
Hook represents a callback-driven interception hook.
type HookAction ¶ added in v0.1.19
type HookAction string
const ( HookActionAllow HookAction = "allow" HookActionBlock HookAction = "block" HookActionMutateWrite HookAction = "mutate_write" )
type HookEngine ¶ added in v0.1.19
type HookEngine struct {
// contains filtered or unexported fields
}
func NewHookEngine ¶ added in v0.1.19
func NewHookEngine(rules []HookRule) *HookEngine
NewHookEngine constructs a hook engine from declarative rules. Rules are compiled into callback hooks internally.
func NewHookEngineWithCallbacks ¶ added in v0.1.19
func NewHookEngineWithCallbacks(hooks []Hook) *HookEngine
NewHookEngineWithCallbacks constructs a hook engine from callback hooks.
func (*HookEngine) After ¶ added in v0.1.19
func (h *HookEngine) After(req HookRequest, result HookResult)
func (*HookEngine) Before ¶ added in v0.1.19
func (h *HookEngine) Before(req *HookRequest) error
func (*HookEngine) Close ¶ added in v0.1.19
func (h *HookEngine) Close()
func (*HookEngine) SetEventFunc ¶ added in v0.1.19
func (h *HookEngine) SetEventFunc(fn func(req HookRequest, result HookResult))
func (*HookEngine) Wait ¶ added in v0.1.19
func (h *HookEngine) Wait()
type HookFileMeta ¶ added in v0.1.19
type HookMatcher ¶ added in v0.1.19
type HookMatcher interface {
Match(req *HookRequest) bool
}
HookMatcher decides whether a hook should apply for a request.
type HookMatcherFunc ¶ added in v0.1.19
type HookMatcherFunc func(req *HookRequest) bool
HookMatcherFunc adapts a function into HookMatcher.
func (HookMatcherFunc) Match ¶ added in v0.1.19
func (f HookMatcherFunc) Match(req *HookRequest) bool
type HookOp ¶ added in v0.1.19
type HookOp string
const ( HookOpStat HookOp = "stat" HookOpReadDir HookOp = "readdir" HookOpOpen HookOp = "open" HookOpCreate HookOp = "create" HookOpMkdir HookOp = "mkdir" HookOpChmod HookOp = "chmod" HookOpRemove HookOp = "remove" HookOpRemoveAll HookOp = "remove_all" HookOpRename HookOp = "rename" HookOpSymlink HookOp = "symlink" HookOpReadlink HookOp = "readlink" HookOpRead HookOp = "read" HookOpWrite HookOp = "write" HookOpClose HookOp = "close" HookOpSync HookOp = "sync" HookOpTruncate HookOp = "truncate" )
type HookRequest ¶ added in v0.1.19
type HookResult ¶ added in v0.1.19
type HookResult struct {
Err error
Bytes int
Meta *HookFileMeta
}
type HookRule ¶ added in v0.1.19
type HookRule struct {
Name string
Phase HookPhase
Ops []HookOp
PathPattern string
Action HookAction
ActionFunc func(ctx context.Context, req HookRequest) HookAction
MutateWriteFunc MutateWriteFunc
MutateWrite []byte
}
type MemoryProvider ¶
type MemoryProvider struct {
// contains filtered or unexported fields
}
func NewMemoryProvider ¶
func NewMemoryProvider() *MemoryProvider
func (*MemoryProvider) Chmod ¶ added in v0.1.10
func (p *MemoryProvider) Chmod(path string, mode os.FileMode) error
func (*MemoryProvider) MkdirAll ¶
func (p *MemoryProvider) MkdirAll(path string, mode os.FileMode) error
func (*MemoryProvider) Readonly ¶
func (p *MemoryProvider) Readonly() bool
func (*MemoryProvider) Remove ¶
func (p *MemoryProvider) Remove(path string) error
func (*MemoryProvider) RemoveAll ¶
func (p *MemoryProvider) RemoveAll(path string) error
func (*MemoryProvider) Rename ¶
func (p *MemoryProvider) Rename(oldPath, newPath string) error
func (*MemoryProvider) Symlink ¶
func (p *MemoryProvider) Symlink(target, link string) error
type MountRouter ¶
type MountRouter struct {
// contains filtered or unexported fields
}
func NewMountRouter ¶
func NewMountRouter(mounts map[string]Provider) *MountRouter
func (*MountRouter) AddMount ¶
func (r *MountRouter) AddMount(path string, provider Provider)
func (*MountRouter) Chmod ¶ added in v0.1.10
func (r *MountRouter) Chmod(path string, mode os.FileMode) error
func (*MountRouter) Readonly ¶
func (r *MountRouter) Readonly() bool
func (*MountRouter) Remove ¶
func (r *MountRouter) Remove(path string) error
func (*MountRouter) RemoveAll ¶
func (r *MountRouter) RemoveAll(path string) error
func (*MountRouter) RemoveMount ¶
func (r *MountRouter) RemoveMount(path string)
func (*MountRouter) Rename ¶
func (r *MountRouter) Rename(oldPath, newPath string) error
func (*MountRouter) Symlink ¶
func (r *MountRouter) Symlink(target, link string) error
type MutateWriteFunc ¶ added in v0.1.19
type MutateWriteFunc func(ctx context.Context, req MutateWriteRequest) ([]byte, error)
MutateWriteFunc computes replacement bytes for a write operation. Returning an error fails the intercepted write.
type MutateWriteRequest ¶ added in v0.1.19
type MutateWriteRequest struct {
Path string
Offset int64
Size int
Mode os.FileMode
UID int
GID int
}
MutateWriteRequest contains metadata for write mutation decisions.
type OpPathMatcher ¶ added in v0.1.19
OpPathMatcher matches by operation and filepath-style glob pattern.
func (OpPathMatcher) Match ¶ added in v0.1.19
func (m OpPathMatcher) Match(req *HookRequest) bool
type Provider ¶
type Provider interface {
Readonly() bool
Stat(path string) (FileInfo, error)
ReadDir(path string) ([]DirEntry, error)
Open(path string, flags int, mode os.FileMode) (Handle, error)
Create(path string, mode os.FileMode) (Handle, error)
Mkdir(path string, mode os.FileMode) error
Chmod(path string, mode os.FileMode) error
Remove(path string) error
RemoveAll(path string) error
Rename(oldPath, newPath string) error
Symlink(target, link string) error
Readlink(path string) (string, error)
}
func NewInterceptProvider ¶ added in v0.1.19
func NewInterceptProvider(inner Provider, hooks *HookEngine) Provider
type ReadonlyProvider ¶
type ReadonlyProvider struct {
// contains filtered or unexported fields
}
func NewReadonlyProvider ¶
func NewReadonlyProvider(inner Provider) *ReadonlyProvider
func (*ReadonlyProvider) Chmod ¶ added in v0.1.10
func (p *ReadonlyProvider) Chmod(path string, mode os.FileMode) error
func (*ReadonlyProvider) Mkdir ¶
func (p *ReadonlyProvider) Mkdir(path string, mode os.FileMode) error
func (*ReadonlyProvider) ReadDir ¶
func (p *ReadonlyProvider) ReadDir(path string) ([]DirEntry, error)
func (*ReadonlyProvider) Readlink ¶
func (p *ReadonlyProvider) Readlink(path string) (string, error)
func (*ReadonlyProvider) Readonly ¶
func (p *ReadonlyProvider) Readonly() bool
func (*ReadonlyProvider) Remove ¶
func (p *ReadonlyProvider) Remove(path string) error
func (*ReadonlyProvider) RemoveAll ¶
func (p *ReadonlyProvider) RemoveAll(path string) error
func (*ReadonlyProvider) Rename ¶
func (p *ReadonlyProvider) Rename(oldPath, newPath string) error
func (*ReadonlyProvider) Symlink ¶
func (p *ReadonlyProvider) Symlink(target, link string) error
type RealFSProvider ¶
type RealFSProvider struct {
// contains filtered or unexported fields
}
func NewRealFSProvider ¶
func NewRealFSProvider(root string) *RealFSProvider
func (*RealFSProvider) Chmod ¶ added in v0.1.10
func (p *RealFSProvider) Chmod(path string, mode os.FileMode) error
func (*RealFSProvider) Readonly ¶
func (p *RealFSProvider) Readonly() bool
func (*RealFSProvider) Remove ¶
func (p *RealFSProvider) Remove(path string) error
func (*RealFSProvider) RemoveAll ¶
func (p *RealFSProvider) RemoveAll(path string) error
func (*RealFSProvider) Rename ¶
func (p *RealFSProvider) Rename(oldPath, newPath string) error
func (*RealFSProvider) Symlink ¶
func (p *RealFSProvider) Symlink(target, link string) error
type VFSDirEntry ¶
type VFSRequest ¶
type VFSRequest struct {
Op OpCode `cbor:"op"`
Path string `cbor:"path,omitempty"`
NewPath string `cbor:"new_path,omitempty"`
Handle uint64 `cbor:"fh,omitempty"`
Offset int64 `cbor:"off,omitempty"`
Size uint32 `cbor:"sz,omitempty"`
Data []byte `cbor:"data,omitempty"`
Flags uint32 `cbor:"flags,omitempty"`
Mode uint32 `cbor:"mode,omitempty"`
UID uint32 `cbor:"uid,omitempty"`
GID uint32 `cbor:"gid,omitempty"`
}
type VFSResponse ¶
type VFSServer ¶
type VFSServer struct {
// contains filtered or unexported fields
}
func NewVFSServer ¶
func (*VFSServer) HandleConnection ¶
HandleConnection handles a single VFS connection. Exported for use by platform-specific backends.
func (*VFSServer) ServeUDS ¶
ServeUDS starts the VFS server on a Unix domain socket This is used by Firecracker vsock which exposes guest vsock ports as UDS
func (*VFSServer) ServeUDSBackground ¶
ServeUDSBackground starts the VFS server on a Unix domain socket in a goroutine Returns a function to stop the server