github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/pkg/proxy/stub_proxy.go (about)

     1  package proxy
     2  
     3  import (
     4  	"net"
     5  )
     6  
     7  // StubProxy is a proxy that is a stub (does nothing).
     8  type StubProxy struct {
     9  	frontendAddr net.Addr
    10  	backendAddr  net.Addr
    11  }
    12  
    13  // Run does nothing.
    14  func (p *StubProxy) Run() {}
    15  
    16  // Close does nothing.
    17  func (p *StubProxy) Close() {}
    18  
    19  // FrontendAddr returns the frontend address.
    20  func (p *StubProxy) FrontendAddr() net.Addr { return p.frontendAddr }
    21  
    22  // BackendAddr returns the backend address.
    23  func (p *StubProxy) BackendAddr() net.Addr { return p.backendAddr }
    24  
    25  // NewStubProxy creates a new StubProxy
    26  func NewStubProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) {
    27  	return &StubProxy{
    28  		frontendAddr: frontendAddr,
    29  		backendAddr:  backendAddr,
    30  	}, nil
    31  }