summaryrefslogtreecommitdiff
path: root/plugins/websockets/wildcard.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-21 11:41:42 +0300
committerValery Piashchynski <[email protected]>2021-06-21 11:41:42 +0300
commitbdcfdd28d705e401973da2beb8a11543e362bda4 (patch)
tree6a80b5b78ce18c7ddf298861d5b0cd05d8c64ccf /plugins/websockets/wildcard.go
parentcee4bc46097506d6e892b6af194751434700621a (diff)
parent87d023d32feef5fe28c9bb65a796deb77d536b15 (diff)
Merge remote-tracking branch 'origin/master' into feature/jobs_plugin
# Conflicts: # plugins/websockets/plugin.go
Diffstat (limited to 'plugins/websockets/wildcard.go')
-rw-r--r--plugins/websockets/wildcard.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/websockets/wildcard.go b/plugins/websockets/wildcard.go
new file mode 100644
index 00000000..2f1c6601
--- /dev/null
+++ b/plugins/websockets/wildcard.go
@@ -0,0 +1,12 @@
+package websockets
+
+import "strings"
+
+type wildcard struct {
+ prefix string
+ suffix string
+}
+
+func (w wildcard) match(s string) bool {
+ return len(s) >= len(w.prefix)+len(w.suffix) && strings.HasPrefix(s, w.prefix) && strings.HasSuffix(s, w.suffix)
+}