func (s *Selector) Match(ctx *fasthttp.RequestCtx) (string, bool) { var matchSlice []byte found := false switch s.RequestAttr { case "IP": matchSlice = []byte(ctx.RemoteIP().String()) case "Method": matchSlice = ctx.Method() case "Path": matchSlice = ctx.Path() case "Host": matchSlice = ctx.Host() case "POST": matchSlice = ctx.PostArgs().Peek(s.SubAttr) case "GET": matchSlice = ctx.QueryArgs().Peek(s.SubAttr) case "Param": matchSlice = ctx.PostArgs().Peek(s.SubAttr) if matchSlice == nil { matchSlice = ctx.QueryArgs().Peek(s.SubAttr) } case "Header": matchSlice = ctx.Request.Header.Peek(s.SubAttr) default: log.Println("unknown request attribute:", s.RequestAttr) } if matchSlice != nil && (s.Regexp == nil || s.Regexp.Match(matchSlice)) { found = true } if s.Negate { found = !found } return string(matchSlice), found }