mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
22 lines
599 B
Go
22 lines
599 B
Go
package support_web
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/amir20/dozzle/internal/container"
|
|
)
|
|
|
|
const (
|
|
URLMarkerStart = "\uE002"
|
|
URLMarkerEnd = "\uE003"
|
|
)
|
|
|
|
// Standard URL regex pattern to match http/https URLs
|
|
var urlRegex = regexp.MustCompile(`(https?://[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}[-a-zA-Z0-9()@:%_+.~#?&/=]*/?(?:[-a-zA-Z0-9@%_+~#?&/=]|\b))`)
|
|
|
|
// MarkURLs marks URLs in the logEvent message with special markers
|
|
func MarkURLs(logEvent *container.LogEvent) bool {
|
|
matcher := NewPatternMatcher(urlRegex, URLMarkerStart, URLMarkerEnd)
|
|
return matcher.MarkInLogEvent(logEvent)
|
|
}
|