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

DigitalTolk / wireguard-ui / 24835132478

23 Apr 2026 12:26PM UTC coverage: 82.607% (+1.5%) from 81.067%
24835132478

Pull #11

github

web-flow
Merge 68b85fd12 into 74711d7b9
Pull Request #11: Fixes

437 of 554 branches covered (78.88%)

Branch coverage included in aggregate %.

431 of 547 new or added lines in 19 files covered. (78.79%)

8 existing lines in 1 file now uncovered.

2878 of 3459 relevant lines covered (83.2%)

13.8 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