2015-12-19 20:28:08 +02:00
|
|
|
package registry
|
|
|
|
|
|
|
|
import (
|
2016-01-17 01:39:47 +02:00
|
|
|
"crypto/tls"
|
2015-12-19 20:28:08 +02:00
|
|
|
"time"
|
2016-01-06 18:25:12 +02:00
|
|
|
|
|
|
|
"golang.org/x/net/context"
|
2015-12-19 20:28:08 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type Options struct {
|
2016-01-17 01:39:47 +02:00
|
|
|
Timeout time.Duration
|
|
|
|
Secure bool
|
|
|
|
TLSConfig *tls.Config
|
2015-12-31 20:14:40 +02:00
|
|
|
|
2016-01-06 18:25:12 +02:00
|
|
|
// Other options for implementations of the interface
|
|
|
|
// can be stored in a context
|
|
|
|
Context context.Context
|
2015-12-19 20:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func Timeout(t time.Duration) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Timeout = t
|
|
|
|
}
|
|
|
|
}
|
2016-01-16 22:25:18 +02:00
|
|
|
|
|
|
|
// Secure communication with the registry
|
|
|
|
func Secure(b bool) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.Secure = b
|
|
|
|
}
|
|
|
|
}
|
2016-01-17 01:39:47 +02:00
|
|
|
|
|
|
|
// Specify TLS Config
|
|
|
|
func TLSConfig(t *tls.Config) Option {
|
|
|
|
return func(o *Options) {
|
|
|
|
o.TLSConfig = t
|
|
|
|
}
|
|
|
|
}
|