• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DigitalTolk / wireguard-ui / 24836418035

23 Apr 2026 12:55PM UTC coverage: 82.477% (+1.4%) from 81.067%
24836418035

push

github

web-flow
Fixes (#11)

* Fixes

* bump

441 of 558 branches covered (79.03%)

Branch coverage included in aggregate %.

447 of 574 new or added lines in 20 files covered. (77.87%)

9 existing lines in 2 files now uncovered.

2882 of 3471 relevant lines covered (83.03%)

13.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/handler/api_audit_middleware.go
1
package handler
2

3
import (
4
        "github.com/DigitalTolk/wireguard-ui/audit"
5
        "github.com/labstack/echo/v4"
6
)
7

8
const auditLoggerKey = "audit_logger"
9

10
// WithAuditLogger middleware injects the audit logger into the echo context
11
func WithAuditLogger(auditLog *audit.Logger) echo.MiddlewareFunc {
123✔
12
        return func(next echo.HandlerFunc) echo.HandlerFunc {
163✔
13
                return func(c echo.Context) error {
80✔
14
                        c.Set(auditLoggerKey, auditLog)
40✔
15
                        return next(c)
40✔
16
                }
40✔
17
        }
18
}
19

20
// getAuditLogger retrieves the audit logger from the echo context
21
func getAuditLogger(c echo.Context) *audit.Logger {
22✔
22
        if al, ok := c.Get(auditLoggerKey).(*audit.Logger); ok {
23✔
23
                return al
1✔
24
        }
1✔
25
        return nil
21✔
26
}
27

28
// auditLog is a convenience function to log an audit event
29
func auditLogEvent(c echo.Context, action, resourceType, resourceID string, details interface{}) {
21✔
30
        al := getAuditLogger(c)
21✔
31
        if al == nil {
42✔
32
                return
21✔
33
        }
21✔
UNCOV
34
        al.Log(audit.Entry{
×
UNCOV
35
                Actor:        currentUser(c),
×
UNCOV
36
                Action:       action,
×
UNCOV
37
                ResourceType: resourceType,
×
UNCOV
38
                ResourceID:   resourceID,
×
UNCOV
39
                Details:      details,
×
UNCOV
40
                IPAddress:    c.RealIP(),
×
UNCOV
41
        })
×
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc