Documentation ¶
Index ¶
- func FileInfoEqual(old, current *GuardFileInfo) bool
- func FileInfoToHash(c *GuardFileInfo) string
- type ApacheDetail
- type ApacheGuardCallback
- type ApacheGuardTarget
- type Guard
- func (g *Guard) AddApacheGuard(id string, intervalSeconds int, cbs ...ApacheGuardCallback)
- func (g *Guard) AddNetConnGuard(id string, intervalSeconds int, options ...NetConnGuardOption) error
- func (g *Guard) AddNginxGuard(id string, intervalSeconds int, cbs ...NginxGuardCallback)
- func (g *Guard) AddPathGuard(id, path string, recursive bool, intervalSeconds int, ...) error
- func (g *Guard) AddPathGuardWithRecover(id, path string, recursive bool, intervalSeconds int, ...) error
- func (g *Guard) AddProcessGuard(id string, intervalSeconds int, options ...PsAuxProcessGuardOption) error
- func (g *Guard) GetAllFilesUnderRecovered() []string
- func (g *Guard) GetOriginFileContent(p string) ([]byte, error)
- func (g *Guard) RecoverFile(p string) error
- func (g *Guard) RemoveApacheGuard(id string)
- func (g *Guard) RemoveNetConnGuard(id string)
- func (g *Guard) RemoveNginxGuard(id string)
- func (g *Guard) RemovePathGuard(id string)
- func (g *Guard) RemoveProcessGuard(id string)
- func (g *Guard) Run(ctx context.Context)
- func (g *Guard) TriggerNetConnectionGuardActionById(id string) error
- func (g *Guard) TriggerPathMonitorGuardActionById(id string) error
- func (g *Guard) TriggerProcessGuardActionById(id string) error
- type GuardFileInfo
- type MySQLServerDetail
- type NetConn
- type NetConnCallback
- type NetConnEventCallback
- type NetConnEventType
- type NetConnGuardOption
- type NetConnGuardTarget
- type NginxDetail
- type NginxGuardCallback
- type NginxGuardTarget
- type PathGuardTarget
- type PathGuardTargetOption
- func SetDisallowNewFile(s ...string) PathGuardTargetOption
- func SetPathGuardCacheFileSize(byteSize int) PathGuardTargetOption
- func SetPathGuardCallback(f pathGuardCallback) PathGuardTargetOption
- func SetPathGuardContentChangeCallback(f pathGuardCallback) PathGuardTargetOption
- func SetPathGuardFileCountLimit(i int) PathGuardTargetOption
- func SetPathGuardFirstToNotify() PathGuardTargetOption
- func SetPathNameExcludes(s ...string) PathGuardTargetOption
- func SetPathNameIncludes(s ...string) PathGuardTargetOption
- func SetPathUnserRecovered(r bool) PathGuardTargetOption
- type PsAuxProcessCallback
- type PsAuxProcessEventCallback
- type PsAuxProcessEventType
- type PsAuxProcessGuardOption
- type PsAuxProcessGuardTarget
- type PsProcess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileInfoEqual ¶
func FileInfoEqual(old, current *GuardFileInfo) bool
func FileInfoToHash ¶
func FileInfoToHash(c *GuardFileInfo) string
Types ¶
type ApacheDetail ¶
type ApacheDetail struct { Process *PsProcess MainPid int `json:"main_pid"` ExecutableFile string `json:"executable_file"` Version string `json:"version"` HttpdRoot string `json:"httpd_root"` ConfigPath string `json:"config_path"` Timestamp int64 `json:"timestamp"` // contains filtered or unexported fields }
func GetApacheDetail ¶
func GetApacheDetail(c context.Context) []*ApacheDetail
func (*ApacheDetail) CalcHash ¶
func (n *ApacheDetail) CalcHash() string
func (*ApacheDetail) IsServing ¶
func (n *ApacheDetail) IsServing() bool
type ApacheGuardCallback ¶
type ApacheGuardCallback func(detail ApacheDetail)
type ApacheGuardTarget ¶
type ApacheGuardTarget struct {
// contains filtered or unexported fields
}
func NewApacheGuardTarget ¶
func NewApacheGuardTarget( interval int, cbs ...ApacheGuardCallback, ) *ApacheGuardTarget
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
func (*Guard) AddApacheGuard ¶
func (g *Guard) AddApacheGuard(id string, intervalSeconds int, cbs ...ApacheGuardCallback)
func (*Guard) AddNetConnGuard ¶
func (g *Guard) AddNetConnGuard(id string, intervalSeconds int, options ...NetConnGuardOption) error
func (*Guard) AddNginxGuard ¶
func (g *Guard) AddNginxGuard(id string, intervalSeconds int, cbs ...NginxGuardCallback)
func (*Guard) AddPathGuard ¶
func (*Guard) AddPathGuardWithRecover ¶
func (*Guard) AddProcessGuard ¶
func (g *Guard) AddProcessGuard(id string, intervalSeconds int, options ...PsAuxProcessGuardOption) error
func (*Guard) GetAllFilesUnderRecovered ¶
func (*Guard) RecoverFile ¶
func (*Guard) RemoveApacheGuard ¶
func (*Guard) RemoveNetConnGuard ¶
func (*Guard) RemoveNginxGuard ¶
func (*Guard) RemovePathGuard ¶
func (*Guard) RemoveProcessGuard ¶
func (*Guard) TriggerNetConnectionGuardActionById ¶
func (*Guard) TriggerPathMonitorGuardActionById ¶
func (*Guard) TriggerProcessGuardActionById ¶
type MySQLServerDetail ¶
type MySQLServerDetail struct { Process *PsProcess MainPid int `json:"main_pid"` // language.*?PATH BaseDir string `json:"base_dir"` DefaultRootDir string `json:"default_root_dir"` // mysql.*?Ver[\s]+%{DATA:full}[\s]+ VersionFull string `json:"version_full"` // mysql.*?Ver[\s]+%{COMMONVERSION:full}[\s]+ VersionShort string `json:"version_short"` // from process BinaryFile string `json:"binary_file"` // --default-files=PATH ConfigPath string `json:"config_path"` DataDir string `json:"data_dir"` }
func GetMySQLServerDetails ¶
func GetMySQLServerDetails(c context.Context) []*MySQLServerDetail
type NetConn ¶
type NetConnCallback ¶
type NetConnCallback func([]*NetConn)
type NetConnEventCallback ¶
type NetConnEventCallback func(eventType NetConnEventType, conn *NetConn)
type NetConnEventType ¶
type NetConnEventType string
const ( NetConnEvent_New NetConnEventType = "new" NetConnEvent_Disappear NetConnEventType = "disappear" )
type NetConnGuardOption ¶
type NetConnGuardOption func(t *NetConnGuardTarget) error
func SetNetConnEventCallback ¶
func SetNetConnEventCallback(f NetConnEventCallback) NetConnGuardOption
func SetNetConnsCallback ¶
func SetNetConnsCallback(f NetConnCallback) NetConnGuardOption
type NetConnGuardTarget ¶
type NetConnGuardTarget struct {
// contains filtered or unexported fields
}
func NewNetConnGuardTarget ¶
func NewNetConnGuardTarget(intervalSeconds int, options ...NetConnGuardOption) (*NetConnGuardTarget, error)
type NginxDetail ¶
type NginxDetail struct { Process *PsProcess MainPid int `json:"main_pid"` Prefix string `json:"prefix"` ConfigPath string `json:"config_path"` Version string `json:"version"` OpensslVersionFull string `json:"openssl_version_full"` OpensslVersion string `json:"openssl_version"` Timestamp int64 `json:"timestamp"` // contains filtered or unexported fields }
func GetNginxDetail ¶
func GetNginxDetail(c context.Context) []*NginxDetail
func (*NginxDetail) CalcHash ¶
func (n *NginxDetail) CalcHash() string
func (*NginxDetail) IsServing ¶
func (n *NginxDetail) IsServing() bool
type NginxGuardCallback ¶
type NginxGuardCallback func(NginxDetail)
type NginxGuardTarget ¶
type NginxGuardTarget struct {
// contains filtered or unexported fields
}
func NewNginxGuardTarget ¶
func NewNginxGuardTarget( interval int, cbs ...NginxGuardCallback, ) *NginxGuardTarget
type PathGuardTarget ¶
type PathGuardTargetOption ¶
type PathGuardTargetOption func(p *PathGuardTarget) error
func SetDisallowNewFile ¶
func SetDisallowNewFile(s ...string) PathGuardTargetOption
func SetPathGuardCacheFileSize ¶
func SetPathGuardCacheFileSize(byteSize int) PathGuardTargetOption
func SetPathGuardCallback ¶
func SetPathGuardCallback(f pathGuardCallback) PathGuardTargetOption
func SetPathGuardContentChangeCallback ¶
func SetPathGuardContentChangeCallback(f pathGuardCallback) PathGuardTargetOption
func SetPathGuardFileCountLimit ¶
func SetPathGuardFileCountLimit(i int) PathGuardTargetOption
func SetPathGuardFirstToNotify ¶
func SetPathGuardFirstToNotify() PathGuardTargetOption
func SetPathNameExcludes ¶
func SetPathNameExcludes(s ...string) PathGuardTargetOption
func SetPathNameIncludes ¶
func SetPathNameIncludes(s ...string) PathGuardTargetOption
func SetPathUnserRecovered ¶
func SetPathUnserRecovered(r bool) PathGuardTargetOption
type PsAuxProcessCallback ¶
type PsAuxProcessCallback func([]*PsProcess)
type PsAuxProcessEventCallback ¶
type PsAuxProcessEventCallback func(name PsAuxProcessEventType, proc *PsProcess)
type PsAuxProcessEventType ¶
type PsAuxProcessEventType string
const ( PsAuxProcessEvent_New PsAuxProcessEventType = "new" PsAuxProcessEvent_Disappear PsAuxProcessEventType = "disappear" )
type PsAuxProcessGuardOption ¶
type PsAuxProcessGuardOption func(t *PsAuxProcessGuardTarget) error
func SetPsAuxProcessCallback ¶
func SetPsAuxProcessCallback(f PsAuxProcessCallback) PsAuxProcessGuardOption
func SetPsAuxProcessEventCallback ¶
func SetPsAuxProcessEventCallback(f PsAuxProcessEventCallback) PsAuxProcessGuardOption
type PsAuxProcessGuardTarget ¶
type PsAuxProcessGuardTarget struct {
// contains filtered or unexported fields
}
func NewPsAuxProcessGuardTarget ¶
func NewPsAuxProcessGuardTarget(intervalSeconds int, options ...PsAuxProcessGuardOption) (*PsAuxProcessGuardTarget, error)
Click to show internal directories.
Click to hide internal directories.