mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-30 22:34:18 -05:00
remove deprecated whitelist flag and struct field
This commit is contained in:
parent
5a07762971
commit
a5297ae319
3 changed files with 4 additions and 12 deletions
|
@ -10,6 +10,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
### Changed
|
||||
- updated docker image to use go1.12 compiler and build imageproxy as a go module.
|
||||
|
||||
### Removed
|
||||
- removed deprecated `whitelist` flag and `Proxy.Whitelist` struct field. Use
|
||||
`allowHosts` and `Proxy.AllowHosts` instead.
|
||||
|
||||
## [0.8.0] (2019-03-21)
|
||||
|
||||
### Added
|
||||
|
|
|
@ -43,7 +43,6 @@ const defaultMemorySize = 100
|
|||
|
||||
var addr = flag.String("addr", "localhost:8080", "TCP address to listen on")
|
||||
var allowHosts = flag.String("allowHosts", "", "comma separated list of allowed remote hosts")
|
||||
var whitelist = flag.String("whitelist", "", "deprecated. use 'allowHosts' instead")
|
||||
var denyHosts = flag.String("denyHosts", "", "comma separated list of denied remote hosts")
|
||||
var referrers = flag.String("referrers", "", "comma separated list of allowed referring hosts")
|
||||
var baseURL = flag.String("baseURL", "", "default base URL for relative remote URLs")
|
||||
|
@ -62,10 +61,6 @@ func init() {
|
|||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *allowHosts == "" {
|
||||
// backwards compatible with old naming of the flag
|
||||
*allowHosts = *whitelist
|
||||
}
|
||||
|
||||
p := imageproxy.NewProxy(nil, cache.Cache)
|
||||
if *allowHosts != "" {
|
||||
|
|
|
@ -47,9 +47,6 @@ type Proxy struct {
|
|||
// proxied from. An empty list means all hosts are allowed.
|
||||
AllowHosts []string
|
||||
|
||||
// Whitelist should no longer be used. Use "AllowHosts" instead.
|
||||
Whitelist []string
|
||||
|
||||
// DenyHosts specifies a list of remote hosts that images cannot be
|
||||
// proxied from.
|
||||
DenyHosts []string
|
||||
|
@ -229,10 +226,6 @@ var (
|
|||
// referrer, host, and signature. It returns an error if the request is not
|
||||
// allowed.
|
||||
func (p *Proxy) allowed(r *Request) error {
|
||||
if p.AllowHosts == nil {
|
||||
// backwards compatible with old naming of the field
|
||||
p.AllowHosts = p.Whitelist
|
||||
}
|
||||
if len(p.Referrers) > 0 && !referrerMatches(p.Referrers, r.Original) {
|
||||
return errReferrer
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue