From 7512e6e7738143bd302d9b20cb1fd0d1d7af9643 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 2 Jan 2025 11:58:29 +0100 Subject: vendor: fetch the dependencies --- vendor/github.com/gobwas/glob/.travis.yml | 14 ++++-- vendor/github.com/gobwas/glob/match/btree.go | 75 +++++++++++++++++++++------- vendor/github.com/gobwas/glob/readme.md | 10 ++-- 3 files changed, 72 insertions(+), 27 deletions(-) (limited to 'vendor/github.com/gobwas') diff --git a/vendor/github.com/gobwas/glob/.travis.yml b/vendor/github.com/gobwas/glob/.travis.yml index e8a276826..1ef96cc30 100644 --- a/vendor/github.com/gobwas/glob/.travis.yml +++ b/vendor/github.com/gobwas/glob/.travis.yml @@ -1,9 +1,15 @@ -sudo: false - language: go - go: - - 1.5.3 + - "1.7.X" + - "1.8.X" + - "1.9.X" + - "1.10.X" + - master + +matrix: + allow_failures: + - go: master +fast_finish: true script: - go test -v ./... diff --git a/vendor/github.com/gobwas/glob/match/btree.go b/vendor/github.com/gobwas/glob/match/btree.go index a8130e93e..8302bf824 100644 --- a/vendor/github.com/gobwas/glob/match/btree.go +++ b/vendor/github.com/gobwas/glob/match/btree.go @@ -51,31 +51,52 @@ func (self BTree) Len() int { } // todo? -func (self BTree) Index(s string) (int, []int) { +func (self BTree) Index(s string) (index int, segments []int) { + //inputLen := len(s) + //// try to cut unnecessary parts + //// by knowledge of length of right and left part + //offset, limit := self.offsetLimit(inputLen) + //for offset < limit { + // // search for matching part in substring + // vi, segments := self.Value.Index(s[offset:limit]) + // if index == -1 { + // return -1, nil + // } + // if self.Left == nil { + // if index != offset { + // return -1, nil + // } + // } else { + // left := s[:offset+vi] + // i := self.Left.IndexSuffix(left) + // if i == -1 { + // return -1, nil + // } + // index = i + // } + // if self.Right != nil { + // for _, seg := range segments { + // right := s[:offset+vi+seg] + // } + // } + + // l := s[:offset+index] + // var left bool + // if self.Left != nil { + // left = self.Left.Index(l) + // } else { + // left = l == "" + // } + //} + return -1, nil } func (self BTree) Match(s string) bool { inputLen := len(s) - - // self.Length, self.RLen and self.LLen are values meaning the length of runes for each part - // here we manipulating byte length for better optimizations - // but these checks still works, cause minLen of 1-rune string is 1 byte. - if self.LengthRunes != -1 && self.LengthRunes > inputLen { - return false - } - // try to cut unnecessary parts // by knowledge of length of right and left part - var offset, limit int - if self.LeftLengthRunes >= 0 { - offset = self.LeftLengthRunes - } - if self.RightLengthRunes >= 0 { - limit = inputLen - self.RightLengthRunes - } else { - limit = inputLen - } + offset, limit := self.offsetLimit(inputLen) for offset < limit { // search for matching part in substring @@ -128,6 +149,24 @@ func (self BTree) Match(s string) bool { return false } +func (self BTree) offsetLimit(inputLen int) (offset int, limit int) { + // self.Length, self.RLen and self.LLen are values meaning the length of runes for each part + // here we manipulating byte length for better optimizations + // but these checks still works, cause minLen of 1-rune string is 1 byte. + if self.LengthRunes != -1 && self.LengthRunes > inputLen { + return 0, 0 + } + if self.LeftLengthRunes >= 0 { + offset = self.LeftLengthRunes + } + if self.RightLengthRunes >= 0 { + limit = inputLen - self.RightLengthRunes + } else { + limit = inputLen + } + return offset, limit +} + func (self BTree) String() string { const n string = "" var l, r string diff --git a/vendor/github.com/gobwas/glob/readme.md b/vendor/github.com/gobwas/glob/readme.md index f58144e73..682f0d691 100644 --- a/vendor/github.com/gobwas/glob/readme.md +++ b/vendor/github.com/gobwas/glob/readme.md @@ -126,10 +126,10 @@ Pattern | Fixture | Match | Speed (ns/op) `^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` | `my dog has very bright eyes` | `false` | 1383 `^https:\/\/.*\.google\..*$` | `https://account.google.com` | `true` | 1205 `^https:\/\/.*\.google\..*$` | `https://google.com` | `false` | 767 -`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://yahoo.com` | `true` | 1435 -`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://google.com` | `false` | 1674 -`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `https://safe.gobwas.com` | `true` | 1039 -`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `http://safe.gobwas.com` | `false` | 272 +`^(https:\/\/.*\.google\..*\|.*yandex\..*\|.*yahoo\..*\|.*mail\.ru)$` | `http://yahoo.com` | `true` | 1435 +`^(https:\/\/.*\.google\..*\|.*yandex\..*\|.*yahoo\..*\|.*mail\.ru)$` | `http://google.com` | `false` | 1674 +`^(https:\/\/.*gobwas\.com\|http://exclude.gobwas.com)$` | `https://safe.gobwas.com` | `true` | 1039 +`^(https:\/\/.*gobwas\.com\|http://exclude.gobwas.com)$` | `http://safe.gobwas.com` | `false` | 272 `^abc.*$` | `abcdef` | `true` | 237 `^abc.*$` | `af` | `false` | 100 `^.*def$` | `abcdef` | `true` | 464 @@ -145,4 +145,4 @@ Pattern | Fixture | Match | Speed (ns/op) ## Syntax Syntax is inspired by [standard wildcards](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm), -except that `**` is aka super-asterisk, that do not sensitive for separators. \ No newline at end of file +except that `**` is aka super-asterisk, that do not sensitive for separators. -- cgit mrf-deployment