summaryrefslogtreecommitdiff
path: root/plugins/websockets/wildcard.go
diff options
context:
space:
mode:
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)
+}