update proxy/options

This commit is contained in:
Asim Aslam 2019-06-06 21:45:28 +01:00
parent 2cc18d6edc
commit c317daf6b8
3 changed files with 4 additions and 15 deletions

View File

@ -18,15 +18,8 @@ func (d *defaultOptions) Init(opts ...Option) error {
return nil
}
func (d *defaultOptions) Options() Options {
return d
}
func (d *defaultOptions) Value(k interface{}) (interface{}, bool) {
if d.opts == nil {
d.opts = new(Values)
}
return d.opts.Get(k)
func (d *defaultOptions) Values() *Values {
return d.opts
}
func (d *defaultOptions) String() string {

View File

@ -9,9 +9,7 @@ type Options interface {
// Initialise options
Init(...Option) error
// Options returns the current options
Options() Options
// Value returns an option value
Value(k interface{}) (interface{}, bool)
Values() *Values
// The name for who these options exist
String() string
}
@ -62,7 +60,7 @@ func WithOption(o Option) Option {
}
// String sets the string
func String(s string) Option {
func WithString(s string) Option {
return WithValue(stringKey{}, s)
}

View File

@ -13,6 +13,4 @@ type Proxy interface {
options.Options
// ServeRequest will serve a request
ServeRequest(context.Context, server.Request, server.Response) error
// run the proxy
Run() error
}