Skip to content

Commit

Permalink
Rename Matcher to Glob
Browse files Browse the repository at this point in the history
  • Loading branch information
sharbov committed Mar 6, 2018
1 parent 6cd642b commit e13a5a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion route/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ func prefixMatcher(uri string, r *Route) bool {

// globMatcher matches path to the routes' path using gobwas/glob.
func globMatcher(uri string, r *Route) bool {
return r.Matcher.Match(uri)
return r.Glob.Match(uri)
}
2 changes: 1 addition & 1 deletion route/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ func TestGlobMatcher(t *testing.T) {
}

func getRoute(path string) *Route {
return &Route{Path: path, Matcher: glob.MustCompile(path)}
return &Route{Path: path, Glob: glob.MustCompile(path)}
}
4 changes: 2 additions & 2 deletions route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"strconv"
"strings"

"github.com/gobwas/glob"
"github.com/fabiolb/fabio/metrics"
"github.com/gobwas/glob"
)

// Route maps a path prefix to one or more target URLs.
Expand Down Expand Up @@ -39,7 +39,7 @@ type Route struct {
total uint64

// Matcher represents compiled pattern.
Matcher glob.Glob
Glob glob.Glob
}

func (r *Route) addTarget(service string, targetURL *url.URL, fixedWeight float64, tags []string, opts map[string]string) {
Expand Down
4 changes: 2 additions & 2 deletions route/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"sync/atomic"

"github.com/fabiolb/fabio/metrics"
"github.com/ryanuber/go-glob"
glob2 "github.com/gobwas/glob"
"github.com/ryanuber/go-glob"
)

var errInvalidPrefix = errors.New("route: prefix must not be empty")
Expand Down Expand Up @@ -154,7 +154,7 @@ func (t Table) addRoute(d *RouteDef) error {
switch {
// add new host
case t[host] == nil:
r := &Route{Host: host, Path: path, Matcher: glob2.MustCompile(path)}
r := &Route{Host: host, Path: path, Glob: glob2.MustCompile(path)}
r.addTarget(d.Service, targetURL, d.Weight, d.Tags, d.Opts)
t[host] = Routes{r}

Expand Down

0 comments on commit e13a5a8

Please sign in to comment.