Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Oct 12, 2024
1 parent b14676f commit 93287b6
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 15 deletions.
10 changes: 10 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# .air.toml

# Set the working directory
root = "."

# Define which files to watch
[build]
cmd = "go run main.go"
include_ext = ["go", "tpl"]
exclude_dir = ["vendor", "tmp"]
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
# - id: golangci-lint
# args: [--fix]
- repo: https://github.com/containerscrew/mtoc
rev: v0.3.2
rev: v0.4.1
hooks:
- id: mtoc
args: [ "-e", ".pytest_cache/"]
Expand Down
4 changes: 0 additions & 4 deletions internal/core/core.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// if err := rlimit.RemoveMemlock(); err != nil {
// log.Error(fmt.Sprintf("failed to remove memlock rlimit: %v. Consider using sudo or give necessary capabilities to the program", err))
// }

package core

import (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/binary"
"errors"
"fmt"
"net"

Expand All @@ -19,7 +18,6 @@ import (
func NetworkTrack(ctx context.Context) {
// Retrieve the context data (log and config) from the context
contextData, _ := ctx.Value("contextData").(*dto.ContextData)
// Now you have access to both the logger and config
log := contextData.Log
config := contextData.Config

Expand Down Expand Up @@ -71,10 +69,6 @@ func NetworkTrack(ctx context.Context) {
// Read an event from the ring buffer
record, err := ringBufferReader.Read()
if err != nil {
if errors.Is(err, ringbuf.ErrClosed) {
log.Warning("Received signal, closing ring buffer reader...")
return
}
log.Warning(fmt.Sprintf("Error reading from ring buffer: %v", err))
continue
}
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func IntToIP(ipNum uint32) net.IP {
return ip
}

// Function to convert UID to username
// GetUsername returns the username for a given UID
func GetUsername(uid uint32) string {
usr, err := user.LookupId(strconv.Itoa(int(uid)))
if err != nil {
Expand All @@ -40,7 +40,7 @@ func IpLookup(ip string) (string, error) {
return "Unknown", nil
}

// Struct to hold the IP information from ip.guide
// IpInfo represents the response from the ip-api.com API
type IPInfo struct {
IP string `json:"ip"`
Network Network `json:"network"`
Expand Down
2 changes: 1 addition & 1 deletion learningStuff/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- START OF TOC !DO NOT EDIT THIS CONTENT MANUALLY-->
**Table of Contents** *generated with [mtoc](https://github.com/containerscrew/mtoc)*
- [Folder with some examples or files I've been testing](#folder-with-some-examples-or-files-i've-been-testing)
- [Folder with some examples or files I've been testing](#folder-with-some-examples-or-files-ive-been-testing)
<!-- END OF TOC -->

# Folder with some examples or files I've been testing
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
devstdout "github.com/containerscrew/devstdout/pkg"
"github.com/containerscrew/kernelsnoop/internal/core"
"github.com/containerscrew/kernelsnoop/internal/dto"
"github.com/containerscrew/kernelsnoop/internal/programs/net_track"
"github.com/containerscrew/kernelsnoop/internal/trackers/net_track"
)

func main() {
Expand Down

0 comments on commit 93287b6

Please sign in to comment.