代码拉取完成,页面将自动刷新
// Package ruleset provides the basics rules which are being extended by rules.
package ruleset
// The shared header-mostly rules for both nethttp and fasthttp
var (
AuthorizationRule = func(header GetHeader) bool {
return header("Authorization") == "" &&
header("Proxy-Authenticate") == ""
}
MustRevalidateRule = func(header GetHeader) bool {
return header("Must-Revalidate") == ""
}
ZeroMaxAgeRule = func(header GetHeader) bool {
return header("S-Maxage") != "0" &&
header("Max-Age") != "0"
}
NoCacheRule = func(header GetHeader) bool {
return header("No-Cache") != "true"
}
)
// THESE ARE HERE BECAUSE THE GOLANG DOESN'T SUPPORTS THE F.... INTERFACE ALIAS, THIS SHOULD EXISTS ONLY ON /$package/rule
// or somehow move interface generic rules (such as conditional, header) here, because the code sharing is exactly THE SAME
// except the -end interface, this on other language can be designing very very nice but here no OOP so we stuck on this,
// it's better than before but not as I wanted to be.
// They will make me to forget my software design skills,
// they (the language's designers) rollback the feature of type alias, BLOG POSTING that is an UNUSEFUL feature.....
// GetHeader is a type of func which receives a func of string which returns a string
// used to get headers values, both request's and response's.
type GetHeader func(string) string
// HeaderPredicate is a type of func which receives a func of string which returns a string and a boolean,
// used to get headers values, both request's and response's.
type HeaderPredicate func(GetHeader) bool
// EmptyHeaderPredicate returns always true
var EmptyHeaderPredicate = func(GetHeader) bool {
return true
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。