add QUIC support

This commit is contained in:
rui.zheng
2017-07-29 16:18:04 +08:00
parent 503568b093
commit 151a2f902b
233 changed files with 27731 additions and 8463 deletions
+11 -14
View File
@@ -30,30 +30,27 @@ func Glob(pattern, subj string) bool {
trailingGlob := strings.HasSuffix(pattern, GLOB)
end := len(parts) - 1
for i, part := range parts {
// Go over the leading parts and ensure they match.
for i := 0; i < end; i++ {
idx := strings.Index(subj, parts[i])
switch i {
case 0:
if leadingGlob {
continue
}
if !strings.HasPrefix(subj, part) {
// Check the first section. Requires special handling.
if !leadingGlob && idx != 0 {
return false
}
case end:
if len(subj) > 0 {
return trailingGlob || strings.HasSuffix(subj, part)
}
default:
if !strings.Contains(subj, part) {
// Check that the middle parts match.
if idx < 0 {
return false
}
}
// Trim evaluated text from subj as we loop over the pattern.
idx := strings.Index(subj, part) + len(part)
subj = subj[idx:]
subj = subj[idx+len(parts[i]):]
}
// All parts of the pattern matched
return true
// Reached the last section. Requires special handling.
return trailingGlob || strings.HasSuffix(subj, parts[end])
}