39 lines
600 B
Go
39 lines
600 B
Go
package registry
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"time"
|
|
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
type Options struct {
|
|
Timeout time.Duration
|
|
Secure bool
|
|
TLSConfig *tls.Config
|
|
|
|
// Other options for implementations of the interface
|
|
// can be stored in a context
|
|
Context context.Context
|
|
}
|
|
|
|
func Timeout(t time.Duration) Option {
|
|
return func(o *Options) {
|
|
o.Timeout = t
|
|
}
|
|
}
|
|
|
|
// Secure communication with the registry
|
|
func Secure(b bool) Option {
|
|
return func(o *Options) {
|
|
o.Secure = b
|
|
}
|
|
}
|
|
|
|
// Specify TLS Config
|
|
func TLSConfig(t *tls.Config) Option {
|
|
return func(o *Options) {
|
|
o.TLSConfig = t
|
|
}
|
|
}
|