add k8s client
This commit is contained in:
36
vendor/gopkg.in/igm/sockjs-go.v2/sockjs/mapping.go
generated
vendored
Normal file
36
vendor/gopkg.in/igm/sockjs-go.v2/sockjs/mapping.go
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package sockjs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type mapping struct {
|
||||
method string
|
||||
path *regexp.Regexp
|
||||
chain []http.HandlerFunc
|
||||
}
|
||||
|
||||
func newMapping(method string, re string, handlers ...http.HandlerFunc) *mapping {
|
||||
return &mapping{method, regexp.MustCompile(re), handlers}
|
||||
}
|
||||
|
||||
type matchType uint32
|
||||
|
||||
const (
|
||||
fullMatch matchType = iota
|
||||
pathMatch
|
||||
noMatch
|
||||
)
|
||||
|
||||
// matches checks if given req.URL is a match with a mapping. Match can be either full, partial (http method mismatch) or no match.
|
||||
func (m *mapping) matches(req *http.Request) (match matchType, method string) {
|
||||
if !m.path.MatchString(req.URL.Path) {
|
||||
match, method = noMatch, ""
|
||||
} else if m.method != req.Method {
|
||||
match, method = pathMatch, m.method
|
||||
} else {
|
||||
match, method = fullMatch, m.method
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user