NewProxy creates a new instance of Proxy with the specified address.
(name string, addr *url.URL)
| 18 | |
| 19 | // NewProxy creates a new instance of Proxy with the specified address. |
| 20 | func NewProxy(name string, addr *url.URL) *Proxy { |
| 21 | return &Proxy{ |
| 22 | name: name, |
| 23 | proxy: httputil.NewSingleHostReverseProxy(addr), |
| 24 | health: health.New(addr), |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // Proxy represents a reverse proxy for load balancing algorithms. |
| 29 | type Proxy struct { |