File: stub_proxy.go

package info (click to toggle)
golang-github-docker-go-connections 0.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 312 kB
  • sloc: makefile: 3
file content (31 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package proxy

import (
	"net"
)

// StubProxy is a proxy that is a stub (does nothing).
type StubProxy struct {
	frontendAddr net.Addr
	backendAddr  net.Addr
}

// Run does nothing.
func (p *StubProxy) Run() {}

// Close does nothing.
func (p *StubProxy) Close() {}

// FrontendAddr returns the frontend address.
func (p *StubProxy) FrontendAddr() net.Addr { return p.frontendAddr }

// BackendAddr returns the backend address.
func (p *StubProxy) BackendAddr() net.Addr { return p.backendAddr }

// NewStubProxy creates a new StubProxy
func NewStubProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) {
	return &StubProxy{
		frontendAddr: frontendAddr,
		backendAddr:  backendAddr,
	}, nil
}