0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-30 22:34:18 -05:00

no need to export signatureKeyList type

This commit is contained in:
Will Norris 2020-02-02 01:28:18 +00:00
parent ef09c1ba31
commit 403735c8e2

View file

@ -48,7 +48,7 @@ var denyHosts = flag.String("denyHosts", "", "comma separated list of denied rem
var referrers = flag.String("referrers", "", "comma separated list of allowed referring 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") var baseURL = flag.String("baseURL", "", "default base URL for relative remote URLs")
var cache tieredCache var cache tieredCache
var signatureKeyList SignatureKeyList var signatureKeys signatureKeyList
var scaleUp = flag.Bool("scaleUp", false, "allow images to scale beyond their original dimensions") var scaleUp = flag.Bool("scaleUp", false, "allow images to scale beyond their original dimensions")
var timeout = flag.Duration("timeout", 0, "time limit for requests served by this proxy") var timeout = flag.Duration("timeout", 0, "time limit for requests served by this proxy")
var verbose = flag.Bool("verbose", false, "print verbose logging messages") var verbose = flag.Bool("verbose", false, "print verbose logging messages")
@ -58,7 +58,7 @@ var userAgent = flag.String("userAgent", "willnorris/imageproxy", "specify the u
func init() { func init() {
flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)") flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)")
flag.Var(&signatureKeyList, "signatureKey", "HMAC key used in calculating request signatures") flag.Var(&signatureKeys, "signatureKey", "HMAC key used in calculating request signatures")
} }
func main() { func main() {
@ -78,7 +78,7 @@ func main() {
if *contentTypes != "" { if *contentTypes != "" {
p.ContentTypes = strings.Split(*contentTypes, ",") p.ContentTypes = strings.Split(*contentTypes, ",")
} }
p.SignatureKeys = signatureKeyList p.SignatureKeys = signatureKeys
if *baseURL != "" { if *baseURL != "" {
var err error var err error
p.DefaultBaseURL, err = url.Parse(*baseURL) p.DefaultBaseURL, err = url.Parse(*baseURL)
@ -102,13 +102,13 @@ func main() {
log.Fatal(http.ListenAndServe(*addr, nil)) log.Fatal(http.ListenAndServe(*addr, nil))
} }
type SignatureKeyList [][]byte type signatureKeyList [][]byte
func (skl *SignatureKeyList) String() string { func (skl *signatureKeyList) String() string {
return fmt.Sprint(*skl) return fmt.Sprint(*skl)
} }
func (skl *SignatureKeyList) Set(value string) error { func (skl *signatureKeyList) Set(value string) error {
key := []byte(value) key := []byte(value)
if strings.HasPrefix(value, "@") { if strings.HasPrefix(value, "@") {
file := strings.TrimPrefix(value, "@") file := strings.TrimPrefix(value, "@")