2014-02-14 23:25:25 +00:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
2015-07-25 08:35:07 +00:00
|
|
|
// StubProxy is a proxy that is a stub (does nothing).
|
2014-02-14 23:25:25 +00:00
|
|
|
type StubProxy struct {
|
|
|
|
frontendAddr net.Addr
|
|
|
|
backendAddr net.Addr
|
|
|
|
}
|
|
|
|
|
2015-07-25 08:35:07 +00:00
|
|
|
// Run does nothing.
|
|
|
|
func (p *StubProxy) Run() {}
|
|
|
|
|
|
|
|
// Close does nothing.
|
|
|
|
func (p *StubProxy) Close() {}
|
|
|
|
|
|
|
|
// FrontendAddr returns the frontend address.
|
2014-02-14 23:25:25 +00:00
|
|
|
func (p *StubProxy) FrontendAddr() net.Addr { return p.frontendAddr }
|
|
|
|
|
2015-07-25 08:35:07 +00:00
|
|
|
// BackendAddr returns the backend address.
|
|
|
|
func (p *StubProxy) BackendAddr() net.Addr { return p.backendAddr }
|
|
|
|
|
|
|
|
// NewStubProxy creates a new StubProxy
|
2014-02-14 23:25:25 +00:00
|
|
|
func NewStubProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) {
|
|
|
|
return &StubProxy{
|
|
|
|
frontendAddr: frontendAddr,
|
|
|
|
backendAddr: backendAddr,
|
|
|
|
}, nil
|
|
|
|
}
|