update proxy/options
This commit is contained in:
		| @@ -18,15 +18,8 @@ func (d *defaultOptions) Init(opts ...Option) error { | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (d *defaultOptions) Options() Options { | func (d *defaultOptions) Values() *Values { | ||||||
| 	return d | 	return d.opts | ||||||
| } |  | ||||||
|  |  | ||||||
| func (d *defaultOptions) Value(k interface{}) (interface{}, bool) { |  | ||||||
| 	if d.opts == nil { |  | ||||||
| 		d.opts = new(Values) |  | ||||||
| 	} |  | ||||||
| 	return d.opts.Get(k) |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (d *defaultOptions) String() string { | func (d *defaultOptions) String() string { | ||||||
|   | |||||||
| @@ -9,9 +9,7 @@ type Options interface { | |||||||
| 	// Initialise options | 	// Initialise options | ||||||
| 	Init(...Option) error | 	Init(...Option) error | ||||||
| 	// Options returns the current options | 	// Options returns the current options | ||||||
| 	Options() Options | 	Values() *Values | ||||||
| 	// Value returns an option value |  | ||||||
| 	Value(k interface{}) (interface{}, bool) |  | ||||||
| 	// The name for who these options exist | 	// The name for who these options exist | ||||||
| 	String() string | 	String() string | ||||||
| } | } | ||||||
| @@ -62,7 +60,7 @@ func WithOption(o Option) Option { | |||||||
| } | } | ||||||
|  |  | ||||||
| // String sets the string | // String sets the string | ||||||
| func String(s string) Option { | func WithString(s string) Option { | ||||||
| 	return WithValue(stringKey{}, s) | 	return WithValue(stringKey{}, s) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,6 +13,4 @@ type Proxy interface { | |||||||
| 	options.Options | 	options.Options | ||||||
| 	// ServeRequest will serve a request | 	// ServeRequest will serve a request | ||||||
| 	ServeRequest(context.Context, server.Request, server.Response) error | 	ServeRequest(context.Context, server.Request, server.Response) error | ||||||
| 	// run the proxy |  | ||||||
| 	Run() error |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user