Documentation
¶
Index ¶
- Constants
- func CloseEventLog(handle uintptr) error
- func CloseHandle(handle uintptr) error
- func CreateEvent(eventAttributes *uintptr, manualReset, initialState uint32, name *uint16) (uintptr, error)
- func DeregisterEventSource(log uintptr) error
- func EventLogRecordNumber(handle uintptr) (uint32, error)
- func EvtClose(handle uintptr) error
- func EvtNextChannelPath(handle uintptr) ([]string, error)
- func EvtOpenChannelEnum(session uintptr) (uintptr, error)
- func FormatContent(buf []byte) string
- func FormatMessage(errorCode uint32) string
- func LookupAccountSid(buf []byte, sidlen, sidoffset uint32) (string, string, error)
- func NotifyChangeEventLog(handle, event uintptr) error
- func OpenEventLog(name string) (uintptr, error)
- func ReadEventLog(handle uintptr, flags, offset uint32) ([]byte, error)
- func RegisterEventSource(uncServerName, sourceName *uint16) (handle uintptr, err error)
- func ReportEvent(log uintptr, etype uint16, category uint16, eventID uint32, userSid *uintptr, ...) error
- func ResetEvent(handle uintptr) error
- func SetEvent(handle uintptr) error
- func WaitForMultipleObjects(handles []uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error)
- type EventEntry
- type EventLogRecord
- type EventNotifier
- type EventWatcher
- type SID_NAME_USE
Constants ¶
View Source
const ( // Use uintptr for cross-platform handle representation. InvalidHandle = uintptr(0) ERROR_HANDLE_EOF syscall.Errno = 38 ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 ERROR_NO_MORE_ITEMS syscall.Errno = 259 NO_ERROR = 0 )
View Source
const ( EVENTLOG_SUCCESS = 0x0000 EVENTLOG_ERROR_TYPE = 0x0001 EVENTLOG_WARNING_TYPE = 0x0002 EVENTLOG_INFORMATION_TYPE = 0x0004 EVENTLOG_AUDIT_SUCCESS = 0x0008 EVENTLOG_AUDIT_FAILURE = 0x0010 )
View Source
const ( // https://learn.microsoft.com/zh-cn/windows/win32/api/winbase/nf-winbase-readeventloga EVENTLOG_SEEK_READ = 0x0002 EVENTLOG_SEQUENTIAL_READ = 0x0001 EVENTLOG_FORWARDS_READ = 0x0004 EVENTLOG_BACKWARDS_READ = 0x0008 )
Variables ¶
This section is empty.
Functions ¶
func CloseEventLog ¶
func CloseHandle ¶
func CreateEvent ¶
func DeregisterEventSource ¶
func EventLogRecordNumber ¶
func EvtNextChannelPath ¶
func EvtOpenChannelEnum ¶
Non-Windows stubs for channel enumeration APIs.
func FormatContent ¶ added in v0.1.1
func FormatMessage ¶
func LookupAccountSid ¶
func NotifyChangeEventLog ¶
func OpenEventLog ¶
func RegisterEventSource ¶
func ReportEvent ¶
func ResetEvent ¶
Types ¶
type EventEntry ¶ added in v0.1.1
type EventLogRecord ¶
type EventLogRecord struct{}
func ParseEventLogData ¶
func ParseEventLogData(buf []byte) *EventLogRecord
func ParserEventLogData ¶
func ParserEventLogData(buf []byte) (*EventLogRecord, error)
type EventNotifier ¶
type EventNotifier struct {
EventLogChannel chan *EventEntry
// contains filtered or unexported fields
}
EventNotifier manages a collection of EventWatchers.
func NewEventNotifier ¶
func NewEventNotifier(ctx context.Context) *EventNotifier
NewEventNotifier creates a new EventNotifier instance.
func (*EventNotifier) AddWatcher ¶
func (en *EventNotifier) AddWatcher(name string) error
AddWatcher adds a new EventWatcher to the EventNotifier.
func (*EventNotifier) Close ¶
func (en *EventNotifier) Close()
Close shuts down all EventWatchers and waits for them to exit.
func (*EventNotifier) GetWatcher ¶
func (en *EventNotifier) GetWatcher(name string) (*EventWatcher, error)
GetWatcher retrieves an EventWatcher by name.
func (*EventNotifier) RemoveWatcher ¶
func (en *EventNotifier) RemoveWatcher(name string) error
RemoveWatcher removes an EventWatcher from the EventNotifier.
type EventWatcher ¶
type EventWatcher struct {
Name string
// contains filtered or unexported fields
}
func NewEventWatcher ¶
func NewEventWatcher(ctx context.Context, name string, eventChan chan *EventEntry) *EventWatcher
func (*EventWatcher) CloseHandles ¶
func (ew *EventWatcher) CloseHandles() error
Close handles cleans up resources for the watcher.
func (*EventWatcher) Init ¶
func (ew *EventWatcher) Init() error
Init sets up fsnotify watcher for the provided file path.
func (*EventWatcher) Listen ¶
func (ew *EventWatcher) Listen()
Listen monitors the fsnotify watcher and emits file contents on write events.
type SID_NAME_USE ¶
type SID_NAME_USE uint32
const ( // https://learn.microsoft.com/zh-cn/windows/win32/api/winnt/ne-winnt-sid_name_use SidTypeUser SID_NAME_USE = iota + 1 SidTypeGroup SidTypeDomain SidTypeAlias SidTypeWellKnownGroup SidTypeDeletedAccount SidTypeInvalid SidTypeUnknown SidTypeComputer SidTypeLabel SidTypeLogonSession )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.